go-delve/delve · error

can not convert %q to %s

Error message

can not convert %q to %s

What it means

Error "can not convert %q to %s" thrown in go-delve/delve.

Source

Thrown at pkg/proc/eval.go:1522

		return
	}
	x.loadValue(LoadFullValue())
	if x.Unreadable != nil {
		stack.err = x.Unreadable
		return
	}
	if constant.BoolVal(x.Value) == v {
		stack.opidx = op.Target - 1
	}
}

// Eval type cast expressions
func (scope *EvalScope) evalTypeCast(op *evalop.TypeCast, stack *evalStack) {
	argv := stack.pop()

	typ := godwarf.ResolveTypedef(op.DwarfType)

	converr := fmt.Errorf("can not convert %q to %s", astutil.ExprToString(op.Node.Args[0]), typ.String())

	// compatible underlying types
	if typeCastCompatibleTypes(argv.RealType, typ) {
		ptyp, isptr := typ.(*godwarf.PtrType)
		_, isvoid := argv.DwarfType.(*godwarf.VoidType)
		if (argv.Kind == reflect.Ptr || isvoid) && argv.loaded && len(argv.Children) > 0 && isptr {
			cv := argv.Children[0]
			argv.Children[0] = *newVariable(cv.Name, cv.Addr, ptyp.Type, cv.bi, cv.mem)
			argv.Children[0].OnlyAddr = true
		}
		argv.RealType = typ
		argv.DwarfType = op.DwarfType
		if isptr {
			argv.Kind = reflect.Ptr // could be converting from unsafe.Pointer
		}
		stack.push(argv)
		return
	}

View on GitHub (pinned to a23773e6c3)

When it happens

Trigger: Thrown at pkg/proc/eval.go:1522 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/947583c005ffa9c7. Report an issue: GitHub.