{"record":{"id":"0bb917e75c5f6467","repo":"github/github-mcp-server","slug":"field-q-is-number-value-must-be-a-number","errorCode":null,"errorMessage":"field %q is NUMBER; value must be a number","messagePattern":"field %q is NUMBER; value must be a number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/projects_batch.go","lineNumber":588,"sourceCode":"\treturn candidates\n}\n\nfunc convertProjectFieldValue(field *ResolvedField, raw any) (githubv4.ProjectV2FieldValue, error) {\n\tvar zero githubv4.ProjectV2FieldValue\n\n\tswitch field.DataType {\n\tcase \"TEXT\":\n\t\ts, ok := raw.(string)\n\t\tif !ok {\n\t\t\treturn zero, fmt.Errorf(\"field %q is TEXT; value must be a string\", field.Name)\n\t\t}\n\t\tv := githubv4.String(s)\n\t\treturn githubv4.ProjectV2FieldValue{Text: &v}, nil\n\n\tcase \"NUMBER\":\n\t\tf, ok := toFloat64(raw)\n\t\tif !ok {\n\t\t\treturn zero, fmt.Errorf(\"field %q is NUMBER; value must be a number\", field.Name)\n\t\t}\n\t\tv := githubv4.Float(f)\n\t\treturn githubv4.ProjectV2FieldValue{Number: &v}, nil\n\n\tcase \"DATE\":\n\t\ts, ok := raw.(string)\n\t\tif !ok {\n\t\t\treturn zero, fmt.Errorf(\"field %q is DATE; value must be a YYYY-MM-DD string\", field.Name)\n\t\t}\n\t\tt, err := time.Parse(\"2006-01-02\", s)\n\t\tif err != nil {\n\t\t\treturn zero, fmt.Errorf(\"field %q is DATE; value %q is not in YYYY-MM-DD format: %w\", field.Name, s, err)\n\t\t}\n\t\treturn githubv4.ProjectV2FieldValue{Date: &githubv4.Date{Time: t}}, nil\n\n\tcase \"SINGLE_SELECT\":\n\t\ts, ok := raw.(string)\n\t\tif !ok || s == \"\" {","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/projects_batch.go#L570-L606","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (field \"Story Points\" is NUMBER)\n{\"updated_field\": {\"name\": \"Story Points\", \"value\": \"8\"}}\n// after\n{\"updated_field\": {\"name\": \"Story Points\", \"value\": 8}}","handlingStrategy":"type-guard","validationCode":"if field.DataType == \"NUMBER\" {\n\tswitch value.(type) {\n\tcase float64, int, int64: // ok\n\tdefault:\n\t\treturn fmt.Errorf(\"field %s is NUMBER: send an unquoted JSON number\", field.Name)\n\t}\n}","typeGuard":"func isJSONNumber(v any) bool {\n\tswitch v.(type) {\n\tcase float64, int, int64: return true\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["github-projects","batch","input-validation","type-mismatch","field-value","number"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}