go-delve/delve · error

can not assign big integer to %T.%q

Error message

can not assign big integer to %T.%q

What it means

SetField in starbind rejects starlark.Int values whose magnitude does not fit in an int64: `n, ok := value.Int64()` fails for arbitrary-precision big ints, so the assignment to the Go int-typed field is refused with this message rather than silently truncating.

Source

Thrown at pkg/terminal/starbind/conv.go:210

		}
		err, _ = ierr.(error)
		if err == nil {
			panic(ierr)
		}
		err = fmt.Errorf("can not assign to %T.%q: %v", v.v.Interface(), name, err)
	}()
	if r, err := v.valueAttr(name); err != nil || r != nil {
		return starlark.NoSuchAttrError(fmt.Sprintf("no field named %s in %T", name, v.v.Interface()))
	}
	r := v.v.FieldByName(name)
	if !r.IsValid() {
		return starlark.NoSuchAttrError(fmt.Sprintf("no field named %q in %T", name, v.v.Interface()))
	}
	switch value := value.(type) {
	case starlark.Int:
		n, ok := value.Int64()
		if !ok {
			return fmt.Errorf("can not assign big integer to %T.%q", v.v.Interface(), name)
		}
		r.SetInt(n)
	case starlark.Float:
		r.SetFloat(float64(value))
	case starlark.String:
		r.SetString(value.GoString())
	case starlark.Bool:
		r.SetBool(bool(value))
	default:
		return fmt.Errorf("can not assign value of type %T to %T.%q", value, v.v.Interface(), name)
	}
	return nil
}

func (v structAsStarlarkValue) valueAttr(name string) (starlark.Value, error) {
	if v.v.Type().Name() != "Variable" || (name != "Value" && name != "Expr") {
		return nil, nil
	}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Reduce the value to something within signed 64-bit range (max 9223372036854775807)
  2. If you need a large constant, store it as a string or split the computation
  3. Check the target field's type; floats can hold large magnitudes if the field is float

Example fix

# before
var.Len = 2**70          # exceeds int64
# after
var.Len = 1 << 62        # fits in int64
Defensive patterns

Strategy: validation

Validate before calling

n = 2**70
assert -2**63 <= n < 2**63, "value exceeds int64 range"
var.Len = n

Type guard

def fits_int64(x):
    return -2**63 <= x < 2**63

Try / catch

try:
    var.Len = big_value
except Exception as e:
    if "big integer" in str(e):
        var.Len = clamp_to_int64(big_value)

Prevention

When it happens

Trigger: A Starlark script assigns an integer literal or computed value exceeding int64 range (e.g. 2**64 or 10**30) to a Go struct field of int/int64 type, e.g. `var.Len = 2**70`.

Common situations: Bit-mask computations in scripts on 64-bit+ constants, or constructing huge counts/addresses that overflow int64.

Related errors


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