Error map

invalid operation: mismatched types Go: invalid operation: a + b (mismatched types int and float64)

Go · layer 4, Application & API

Open the full error page →

Centre: this error. First ring: errors it is linked with (10). Outer ring: what those are linked with. Colours show the layer of a request each error belongs to. Click any dot to re-centre the map on it; hover to follow its connections. The centre dot opens the error page.

invalid operation: mismatched types — Go: invalid operation: a + b (mismatched types int and float64) (Go)invalid ope…E0308 — Rust: error[E0308]: mismatched types — expected `X`, found `Y` (Rust)E0308function main is undeclared in the main package — Go: runtime.main_main·f: function main is undeclared in the main package (Go)function main is un…imported and not used — Go: ./main.go:5:2: "os" imported and not used (Go)imported and not us…cannot assign to struct field m[k].f in map — Go: cannot assign to struct field users["bob"].Age in map (Go)cannot assign to st…cannot use x as type in assignment/argument — Go: cannot use "5" (untyped string constant) as int value in argument to f (Go)cannot use x as typ…does not implement interface (missing method) — Go: cannot use &Dog{} (value of type *Dog) as Animal value: *Dog does not implement Animal (missing method Speak) (Go)does not implement …import cycle not allowed — Go: package app/models imports app/utils imports app/models: import cycle not allowed (Go)import cycle not al…assignment mismatch: 1 variable but f returns 2 values — Go: assignment mismatch: 1 variable but os.Open returns 2 values (Go)assignment mismatch…E0412: cannot find type in this scope — Rust: error[E0412]: cannot find type `User` in this scope (Rust)E0412: cannot find …E0271: type mismatch resolving associated type — Rust: error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == i32` (Rust)E0271: type mismatc…AttributeError — AttributeError: 'X' object has no attribute 'y' (Python)AttributeErrorClassCastException — java.lang.ClassCastException: class A cannot be cast to class B (Java)ClassCastExceptionTS7016 — TS7016: Could not find a declaration file for module 'x'. 'x.js' implicitly has an 'any' type. (Node.js)TS7016COPY failed — COPY failed: file not found in build context / "/app/x": not found (Docker)COPY faileddid not complete successfully — failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1 (Docker)did not complete su…failed to read dockerfile — failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory (Docker)failed to read dock…declared and not used — Go: declared and not used: x / "fmt" imported and not used (Go)declared and not us…undefined: x — Go: ./main.go:12:2: undefined: handler (Go)undefined: xmissing return — Go: ./main.go:18:1: missing return (Go)missing returnno new variables on left side of := — Go: ./main.go:9:6: no new variables on left side of := (Go)no new variables on…not enough / too many arguments in call — Go: not enough arguments in call to f have (int) want (int, string) (Go)not enough / too ma…cannot refer to unexported name — Go: cannot refer to unexported name pkg.helper (undefined: pkg.helper) (Go)cannot refer to une…syntax error: unexpected newline — Go: ./main.go:8:2: syntax error: unexpected newline, expected comma or ) (Go)syntax error: unexp…sql: no rows in result set — Go: sql: no rows in result set (Go)sql: no rows in res…panic: interface conversion — Go: panic: interface conversion: interface {} is string, not int (Go)panic: interface co…cannot find package in any of GOROOT / GOPATH — Go: cannot find package "github.com/pkg/errors" in any of: /usr/local/go/src/github.com/pkg/errors (from $GOROOT) /go/src/github.com/pkg/errors (from $GOPATH) (Go)cannot find package…no required module provides package — Go: no required module provides package github.com/foo/bar; to add it: go get github.com/foo/bar (Go)no required module …context deadline exceeded — Go: Get "https://api.example.com": context deadline exceeded (Client.Timeout exceeded while awaiting headers) (Go)context deadline ex…context canceled — Go: context canceled (rpc error: code = Canceled desc = context canceled) (Go)context canceledjson: cannot unmarshal string into Go struct field — Go: json: cannot unmarshal string into Go struct field User.age of type int (Go)json: cannot unmars…invalid conversion from — C++: error: invalid conversion from 'const char*' to 'char*' [-fpermissive] (C/C++)invalid conversion …does not name a type — C++: error: 'string' does not name a type (C/C++)does not name a typecall of overloaded is ambiguous — C++: error: call of overloaded 'f(int)' is ambiguous (C/C++)call of overloaded …narrowing conversion — C++: error: narrowing conversion of 'x' from 'int' to 'char' inside { } [-Wnarrowing] (C/C++)narrowing conversiontemplate argument deduction/substitution failed — C++: error: template argument deduction/substitution failed / couldn't deduce template parameter (C/C++)template argument d…ISO C++ forbids comparison between pointer and integer — C++: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] (C/C++)ISO C++ forbids com…

Directly related (10)

E0308Rust

Rust: error[E0308]: mismatched types — expected `X`, found `Y`

A value’s type doesn’t match what the context expects — common with &str vs String, Option/Result vs plain values, and integer ty…

function main is undeclared in the main packageGo

Go: runtime.main_main·f: function main is undeclared in the main package

The package is named `main` but contains no `func main()`, or you tried to build a library as an executable.

imported and not usedGo

Go: ./main.go:5:2: "os" imported and not used

The file imports a package that no code in that file uses; Go treats this as a compile error, not a warning.

cannot assign to struct field m[k].f in mapGo

Go: cannot assign to struct field users["bob"].Age in map

Map values are not addressable, so you cannot modify a field of a struct stored directly in a map.

cannot use x as type in assignment/argumentGo

Go: cannot use "5" (untyped string constant) as int value in argument to f

A value's type is not assignable to the type required by the variable, parameter or return value.

does not implement interface (missing method)Go

Go: cannot use &Dog{} (value of type *Dog) as Animal value: *Dog does not implement Animal (missing method Speak)

A type was used as an interface but lacks a method or has it with a different signature or receiver type.

import cycle not allowedGo

Go: package app/models imports app/utils imports app/models: import cycle not allowed

Two or more packages import each other directly or indirectly, which Go forbids.

assignment mismatch: 1 variable but f returns 2 valuesGo

Go: assignment mismatch: 1 variable but os.Open returns 2 values

The number of variables on the left does not match the number of values the function returns.

E0412: cannot find type in this scopeRust

Rust: error[E0412]: cannot find type `User` in this scope

A type name isn't defined or imported in the current module.

E0271: type mismatch resolving associated typeRust

Rust: error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == i32`

A trait's associated type (Iterator::Item, Future::Output) doesn't match what's expected.

Two steps away (26)

AttributeErrorPython

AttributeError: 'X' object has no attribute 'y'

You accessed an attribute or method that doesn’t exist on that object type.

ClassCastExceptionJava

java.lang.ClassCastException: class A cannot be cast to class B

An object was cast to a type it isn’t.

TS7016Node.js

TS7016: Could not find a declaration file for module 'x'. 'x.js' implicitly has an 'any' type.

The JavaScript package has no TypeScript types bundled and no @types package installed.

COPY failedDocker

COPY failed: file not found in build context / "/app/x": not found

The Dockerfile COPY refers to a path outside the build context, excluded by .dockerignore, or relative to the wrong directory.

did not complete successfullyDocker

failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1

A RUN step in your Dockerfile failed. The real error is printed in the lines just above this message.

failed to read dockerfileDocker

failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory

docker build can’t find a Dockerfile in the build context you passed.

declared and not usedGo

Go: declared and not used: x / "fmt" imported and not used

Go refuses to compile code with unused local variables or unused imports.

undefined: xGo

Go: ./main.go:12:2: undefined: handler

The compiler cannot find an identifier — a typo, a missing import, or it lives in another file/package that wasn't built.

missing returnGo

Go: ./main.go:18:1: missing return

A function with a return type can reach its end without a return statement on some path.

no new variables on left side of :=Go

Go: ./main.go:9:6: no new variables on left side of :=

`:=` declares variables, but all names on the left already exist in the same scope.

not enough / too many arguments in callGo

Go: not enough arguments in call to f have (int) want (int, string)

A function was called with fewer or more arguments than it declares.

cannot refer to unexported nameGo

Go: cannot refer to unexported name pkg.helper (undefined: pkg.helper)

You used a lowercase (unexported) identifier from another package; only capitalised names are visible outside their package.

syntax error: unexpected newlineGo

Go: ./main.go:8:2: syntax error: unexpected newline, expected comma or )

The parser met a line break where it needed more tokens, usually a missing trailing comma in a multi-line literal or a misplaced…

sql: no rows in result setGo

Go: sql: no rows in result set

`QueryRow(...).Scan(...)` found no row for the query.

panic: interface conversionGo

Go: panic: interface conversion: interface {} is string, not int

A type assertion `x.(T)` failed because the dynamic type of the interface is not T.

cannot find package in any of GOROOT / GOPATHGo

Go: cannot find package "github.com/pkg/errors" in any of: /usr/local/go/src/github.com/pkg/errors (from $GOROOT) /go/src/github.com/pkg/errors (from $GOPATH)

Go could not locate an imported package — it is not downloaded, the module is not initialised, or GOPATH mode is in effect.

no required module provides packageGo

Go: no required module provides package github.com/foo/bar; to add it: go get github.com/foo/bar

The code imports a package whose module is not listed in `go.mod`.

context deadline exceededGo

Go: Get "https://api.example.com": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

An operation did not finish before its context deadline or HTTP client timeout.

context canceledGo

Go: context canceled (rpc error: code = Canceled desc = context canceled)

The context was cancelled before the operation finished — the caller gave up, the client disconnected, or a parent was cancelled.

json: cannot unmarshal string into Go struct fieldGo

Go: json: cannot unmarshal string into Go struct field User.age of type int

The JSON value's type does not match the Go field type (string vs number, object vs array).

invalid conversion fromC/C++

C++: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

C++ forbids silently dropping `const` or converting between unrelated pointer types — typically a string literal assigned to `cha…

does not name a typeC/C++

C++: error: 'string' does not name a type

Where the compiler expected a type, it found a name it does not know as one — a missing header, namespace, or class declared late…

call of overloaded is ambiguousC/C++

C++: error: call of overloaded 'f(int)' is ambiguous

Two or more overloads fit equally well, so the compiler refuses to guess which function you meant.

narrowing conversionC/C++

C++: error: narrowing conversion of 'x' from 'int' to 'char' inside { } [-Wnarrowing]

Brace initialisation `{}` refuses conversions that can lose data, such as `double` to `int` or a runtime `int` to `char`.

template argument deduction/substitution failedC/C++

C++: error: template argument deduction/substitution failed / couldn't deduce template parameter

The compiler could not work out the template arguments from your call — the arguments disagree, the type can't be deduced, or a c…

ISO C++ forbids comparison between pointer and integerC/C++

C++: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

You compared a string literal or pointer with a character or integer — typically `ch == "y"` instead of `ch == 'y'`.