go-delve/delve · error
could not find symbol value for %s
Error message
could not find symbol value for %s
What it means
In compileTypeCastOrFuncCall, when the callee is a plain identifier that is neither a known function nor a resolvable type, Delve checks if it resolves as a type (FindTypeExpr); if not, it produces 'could not find symbol value for <name>' as the fallback error for a failed type cast. This means the identifier could not be resolved to any symbol, function, or type visible at the current location.
Source
Thrown at pkg/proc/evalop/evalcompile.go:539
}
switch n := fnnode.(type) {
case *ast.BasicLit:
// It can only be a ("type string")(x) type cast
return ctx.compileTypeCast(node, nil)
case *ast.ArrayType, *ast.StructType, *ast.FuncType, *ast.InterfaceType, *ast.MapType, *ast.ChanType:
return ctx.compileTypeCast(node, nil)
case *ast.SelectorExpr:
if _, isident := n.X.(*ast.Ident); isident {
if typ, _ := ctx.FindTypeExpr(n); typ != nil {
return ctx.compileTypeCast(node, nil)
}
return ambiguous()
}
return ctx.compileFunctionCall(node, toplevel)
case *ast.Ident:
if typ, _ := ctx.FindTypeExpr(n); typ != nil {
return ctx.compileTypeCast(node, fmt.Errorf("could not find symbol value for %s", n.Name))
}
return ctx.compileFunctionCall(node, toplevel)
case *ast.IndexExpr:
// Ambiguous, could be a parametric type
switch n.X.(type) {
case *ast.Ident, *ast.SelectorExpr:
// Do the type-cast first since evaluating node.Fun could be expensive.
err := ctx.compileTypeCast(node, nil)
if err == nil || err != reader.ErrTypeNotFound {
return err
}
return ctx.compileFunctionCall(node, toplevel)
default:
return ctx.compileFunctionCall(node, toplevel)
}
case *ast.IndexListExpr:
return ctx.compileTypeCast(node, nil)
default:View on GitHub (pinned to a23773e6c3)
Solutions
- Check spelling and scope: switch to the frame where the symbol is in scope ('frame N') or qualify with a package name ('main.myFunc')
- Verify the binary was built with optimizations that didn't eliminate the symbol (use -gcflags='all=-N -l')
- If it is a type cast, ensure the type name is fully qualified and present in DWARF (not a stripped binary)
- Use 'locals'/'vars'/'funcs <name>' to confirm the symbol exists before calling it
Example fix
// before (dlv) call procsess(x) // typo // after (dlv) funcs procsess // verify name (dlv) call process(x)
Defensive patterns
Strategy: validation
Validate before calling
// At the REPL: confirm the symbol exists before calling // (dlv) funcs myFunc // (dlv) locals // In tooling: check the identifier against known function/variable lists first.
Type guard
null
Try / catch
// Wrap evaluation and surface a scope-check hint
res, err := eval(expr)
if err != nil && strings.Contains(err.Error(), "could not find symbol value for") {
return fmt.Errorf("%w: run 'funcs'/'locals' to verify the symbol is in scope", err)
} Prevention
- Build with -gcflags='all=-N -l' to keep symbols alive
- Qualify package-level symbols (pkg.Func)
- Switch to the correct frame before evaluating
When it happens
Trigger: Calling or casting an unknown identifier, e.g. 'call foo()' where foo is not in scope, or a type conversion like 'T(x)' where T is not a visible type/symbol. Also occurs when the identifier is shadowed, stripped by the compiler (inlined away), or belongs to a package not imported into the current frame.
Common situations: Typo in a function/variable/type name at the (dlv) prompt; referring to a symbol optimized out or inlined; using a type from a package whose DWARF info isn't loaded (stripped binaries); generics/parametric types partially matching.
Related errors
- shift count must not be negative
- invalid argument %s (type %s) for cap
- wrong number of arguments to len: %d
- invalid argument %s (type %s) for len
- wrong number of arguments to complex: %d
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/091d36e18306a117.
Report an issue: GitHub.