go-delve/delve · error
not hashable
Error message
not hashable
What it means
Delve's starlarkUnhashable placeholder type implements starlark.Value but its Hash() method always returns the error 'not hashable'. It is used for API values that cannot be mapped to a Starlark type; any attempt to use such a value as a Starlark dict key or set member calls Hash() and receives this error.
Source
Thrown at pkg/terminal/starbind/conv.go:756
}
func (tgt starlarkTargetObject) Attr(name string) (starlark.Value, error) {
env := tgt.env
v, err := env.ctx.Client().EvalVariable(env.ctx.Scope(), name, env.ctx.LoadConfig())
if err != nil {
return starlark.None, fmt.Errorf("could not find variable %q: %v", name, err)
}
return env.variableValueToStarlarkValue(v, true)
}
type starlarkUnhashable struct {
}
func (starlarkUnhashable) Freeze() {
}
func (starlarkUnhashable) Hash() (uint32, error) {
return 0, errors.New("not hashable")
}
View on GitHub (pinned to a23773e6c3)
Solutions
- Use only hashable Starlark types (strings, ints, bools, tuples of hashables) as dict keys; convert variable values with str() first.
- Avoid placing dlv-returned values directly in dicts or sets; store them in lists or under string keys.
- Check the value's type before hashing, e.g. `if type(v) == "string": d[v] = ...`.
Example fix
// before
d = {}
d[var_value] = "seen" # error: not hashable
// after
d = {}
d[str(var_value)] = "seen" Defensive patterns
Strategy: type-guard
Validate before calling
def is_hashable(v):
try:
hash(v)
return True
except Exception:
return False Type guard
def is_hashable(v):
return type(v) in ("string", "int", "float", "bool", "NoneType") or type(v) == "tuple" Try / catch
try:
d[key] = value
except Exception as e:
if "not hashable" in str(e):
d[str(key)] = value # fall back to string key
else:
raise Prevention
- Use str() on variable values before using them as dict keys
- Keep dict keys to primitive Starlark types (string/int/bool/tuple)
- Never store dlv-returned values directly as keys
When it happens
Trigger: In a Starlark script, using a value returned by a Delve binding that maps to starlarkUnhashable (unmappable/unloaded values) as a dictionary key, in a set, or in any hash-requiring context.
Common situations: Scripts building dicts keyed by variable values (e.g. grouping variables by value); comparing unmapped values in dict lookups; using complex/unsupported types as keys.
Related errors
- value not loaded
- cycle in load graph
- argument of dlv_command is not a string
- wrong number of arguments
- argument of read_file was not a string
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/16b0bdeae839940d.
Report an issue: GitHub.