github/github-mcp-server · error
field %q is NUMBER; value must be a number
Error message
field %q is NUMBER; value must be a number
What it means
Raised by convertProjectFieldValue (pkg/github/projects_batch.go:588) when the resolved field has DataType "NUMBER" but the supplied value cannot be treated as a number by toFloat64: strings ("42"), bools, null, arrays, objects, or NaN/Infinity. Note toFloat64 accepts float64, int, and int64 — so any valid JSON number passes. The mismatch fails conversion before the write; values must be sent as JSON numbers.
Source
Thrown at pkg/github/projects_batch.go:588
return candidates
}
func convertProjectFieldValue(field *ResolvedField, raw any) (githubv4.ProjectV2FieldValue, error) {
var zero githubv4.ProjectV2FieldValue
switch field.DataType {
case "TEXT":
s, ok := raw.(string)
if !ok {
return zero, fmt.Errorf("field %q is TEXT; value must be a string", field.Name)
}
v := githubv4.String(s)
return githubv4.ProjectV2FieldValue{Text: &v}, nil
case "NUMBER":
f, ok := toFloat64(raw)
if !ok {
return zero, fmt.Errorf("field %q is NUMBER; value must be a number", field.Name)
}
v := githubv4.Float(f)
return githubv4.ProjectV2FieldValue{Number: &v}, nil
case "DATE":
s, ok := raw.(string)
if !ok {
return zero, fmt.Errorf("field %q is DATE; value must be a YYYY-MM-DD string", field.Name)
}
t, err := time.Parse("2006-01-02", s)
if err != nil {
return zero, fmt.Errorf("field %q is DATE; value %q is not in YYYY-MM-DD format: %w", field.Name, s, err)
}
return githubv4.ProjectV2FieldValue{Date: &githubv4.Date{Time: t}}, nil
case "SINGLE_SELECT":
s, ok := raw.(string)
if !ok || s == "" {View on GitHub (pinned to 0ea1f775a7)
Solutions
- Send the value unquoted: "value": 8 instead of "8"
- Parse numeric source strings to int/float before building the payload
- To clear a number field, use the dedicated clear operation rather than null or 0-by-accident
- Check the field's data_type via list_project_fields when types are uncertain
Example fix
// before (field "Story Points" is NUMBER)
{"updated_field": {"name": "Story Points", "value": "8"}}
// after
{"updated_field": {"name": "Story Points", "value": 8}} Defensive patterns
Strategy: type-guard
Validate before calling
if field.DataType == "NUMBER" {
switch value.(type) {
case float64, int, int64: // ok
default:
return fmt.Errorf("field %s is NUMBER: send an unquoted JSON number", field.Name)
}
} Type guard
func isJSONNumber(v any) bool {
switch v.(type) {
case float64, int, int64: return true
}
return false
} Prevention
- Parse numeric source strings to numbers at the boundary — never forward quoted numbers
- Cache field data types per project so payloads are shaped correctly on the first try
- Use the clear flow to blank a number field; null/0-by-accident are not clears
When it happens
Trigger: A number field (e.g. "Story Points", "Velocity") updated with "value": "8" (quoted), true, or null. The field type comes from the GitHub project; the caller sent the wrong JSON type.
Common situations: Numbers quoted by CSV/JSON exports or string-typed config; a null intended to blank out a number field (unsupported here — use the clear flow); booleans for 0/1 flags; clients that forward all values as strings for safety.
Related errors
- field %q is TEXT; value must be a string
- node_id must be a non-empty string
- item_id: %w
- %s must be a non-empty string
- %s must be a positive integer: %w
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/0bb917e75c5f6467.
Report an issue: GitHub.