multica-ai/multica · error
value must be a number
Error message
value must be a number
What it means
validatePropertyValue requires number-type property values to arrive as a JSON number, which Go's encoding/json decodes into float64. Sending the number as a string, boolean, object, or array fails this type assertion. Note the code does no range or integer check — only the JSON type matters.
Source
Thrown at server/internal/handler/property.go:345
}
return json.Marshal(sanitizeNullBytes(s))
case "url":
s, ok := v.(string)
if !ok {
return nil, errors.New("value must be a URL string")
}
s = strings.TrimSpace(s)
if len(s) > maxPropertyURLValueLen {
return nil, fmt.Errorf("value must be %d characters or fewer", maxPropertyURLValueLen)
}
u, err := url.Parse(s)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
return nil, errors.New("value must be an http(s) URL")
}
return json.Marshal(s)
case "number":
if _, ok := v.(float64); !ok {
return nil, errors.New("value must be a number")
}
return json.Marshal(v)
case "checkbox":
if _, ok := v.(bool); !ok {
return nil, errors.New("value must be true or false")
}
return json.Marshal(v)
case "date":
s, ok := v.(string)
if !ok {
return nil, errors.New("value must be a date string in YYYY-MM-DD format")
}
if _, err := time.Parse("2006-01-02", s); err != nil {
return nil, errors.New("value must be a date string in YYYY-MM-DD format")
}
return json.Marshal(s)
case "select":
s, ok := v.(string)View on GitHub (pinned to 2c0912b6ec)
Solutions
- Send a raw JSON number: {"value": 42} not {"value": "42"}
- Parse form input with Number(...) before building the payload
- For values exceeding float64 precision, be aware the backend stores float64 — round or clamp client-side
Example fix
// before
{ value: "42" }
// after
{ value: 42 } Defensive patterns
Strategy: type-guard
Validate before calling
if (def.type === 'number') {
const n = Number(value);
if (Number.isNaN(n)) throw new Error('Property expects a JSON number');
payload.value = n;
} Type guard
function isNumberPropertyValue(v: unknown): v is number {
return typeof v === 'number' && Number.isFinite(v);
} Prevention
- Parse form strings with Number() before JSON.stringify
- Never quote numeric fields in payloads
- Remember the backend stores float64 — avoid >2^53 integers
When it happens
Trigger: PUT/PATCH a number property with {"value": "42"} (quoted), {"value": true}, or {"value": {"n": 42}}. Typical when HTML form inputs produce strings and the client forgets to parse them, or a strict-typed client sends BigInt as a string.
Common situations: Form submissions where quantity/estimate fields arrive as text; spreadsheet imports mapping cells to strings; JSON.stringify of values already stringified once.
Related errors
- value cannot be empty (use DELETE to unset a property)
- value must be a URL string
- value must be an http(s) URL
- value must be true or false
- value must be a date string in YYYY-MM-DD format
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/7bc257a1ab853b8b.
Report an issue: GitHub.