go-delve/delve · error

expression %q should be boolean not %s

Error message

expression %q should be boolean not %s

What it means

Error "expression %q should be boolean not %s" thrown in go-delve/delve.

Source

Thrown at pkg/proc/eval.go:1500

			return
		}
		return
	case evalop.JumpAlways:
		stack.opidx = op.Target - 1
		return
	case evalop.JumpIfPinningDone:
		fncall := stack.fncallPeek()
		if len(fncall.addrsToPin) == 0 {
			stack.opidx = op.Target - 1
		}
		return
	default:
		panic("internal error, bad jump condition")
	}

	if x.Kind != reflect.Bool {
		if op.Node != nil {
			stack.err = fmt.Errorf("expression %q should be boolean not %s", astutil.ExprToString(op.Node), x.Kind)
		} else {
			stack.err = errors.New("internal debugger error: expected boolean")
		}
		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()

View on GitHub (pinned to a23773e6c3)

When it happens

Trigger: Thrown at pkg/proc/eval.go:1500 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/e5b33eae730066a1. Report an issue: GitHub.