t8y2/dbx · error

invalid attribute number %q

Error message

invalid attribute number %q

What it means

parseVastbaseConstraintAttributeNumbers splits a constraint's attribute-number text (conkey/confkey) on commas, spaces and tabs and converts each token with strconv.Atoi. Any token that isn't a plain integer produces 'invalid attribute number %q' with the offending token quoted.

Source

Thrown at agents/drivers/vastbase-go/vastbase_metadata.go:1713

		if err := rows.Scan(&number, &name); err != nil {
			return nil, err
		}
		result[number] = name
	}
	return result, rows.Err()
}

func parseVastbaseConstraintAttributeNumbers(raw string) ([]int, error) {
	value := strings.TrimSpace(strings.Trim(raw, "{}[]"))
	if value == "" {
		return []int{}, nil
	}
	parts := strings.FieldsFunc(value, func(r rune) bool { return r == ',' || r == ' ' || r == '\t' })
	result := make([]int, 0, len(parts))
	for _, part := range parts {
		number, err := strconv.Atoi(strings.TrimSpace(part))
		if err != nil {
			return nil, fmt.Errorf("invalid attribute number %q", part)
		}
		result = append(result, number)
	}
	return result, nil
}

func parseVastbaseConstraintValue(raw any) string {
	if raw == nil {
		return ""
	}
	if bytes, ok := raw.([]byte); ok {
		return strings.ToLower(strings.TrimSpace(string(bytes)))
	}
	return strings.ToLower(strings.TrimSpace(fmt.Sprint(raw)))
}

func parseVastbaseConstraintValid(raw any) bool {
	if value, ok := raw.(bool); ok {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Locate the offending value: SELECT conkey/confkey from the catalog for the constraint being introspected and inspect the raw text.
  2. If the data is genuinely corrupt, recreate the constraint (DROP/ADD CONSTRAINT) to regenerate catalog values.
  3. Check driver/server version compatibility; format expectations may need a driver update.
  4. Trim or normalize the stored text if it contains stray characters, then retry.
Defensive patterns

Strategy: validation

Validate before calling

func validAttrNumbers(s string) bool {
    for _, tok := range strings.FieldsFunc(s, func(r rune) bool { return r == ',' || r == ' ' || r == '\t' }) {
        if _, err := strconv.Atoi(tok); err != nil { return false }
    }
    return true
}

Try / catch

if err != nil && strings.Contains(err.Error(), "invalid attribute number") {
    // extract quoted token from error, dump the raw catalog value for diagnosis
    return diagnoseConstraintColumns(err)
}

Prevention

When it happens

Trigger: A constraint catalog value contains a non-numeric token after splitting — e.g. '1 2 x', an empty segment producing weird tokens after normalization, or locale/encoding artifacts in the catalog text.

Common situations: Server builds storing attribute arrays in a different textual format than expected; corrupted catalog rows; copying constraints across systems via dumps that altered the representation.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/befa9c2b58f6f2ef. Report an issue: GitHub.