{"record":{"id":"5b9d5dd66c2eae09","repo":"gastownhall/beads","slug":"unsupported-value-t-for-update-field-q","errorCode":null,"errorMessage":"unsupported value %T for update field %q","messagePattern":"unsupported value %T for update field %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/update.go","lineNumber":754,"sourceCode":"\t\t\t\tpatch.Metadata.Set = set\n\t\t\t}\n\t\tcase storageissueops.OpUnsetMetadata:\n\t\t\tpatch.Metadata.Unset, ok = value.([]string)\n\t\tcase \"wisp\":\n\t\t\tvar flag bool\n\t\t\tif flag, ok = value.(bool); ok {\n\t\t\t\twisp = &flag\n\t\t\t}\n\t\tcase \"no_history\":\n\t\t\tvar flag bool\n\t\t\tif flag, ok = value.(bool); ok {\n\t\t\t\tnoHistory = &flag\n\t\t\t}\n\t\tdefault:\n\t\t\treturn issueops.IssuePatch{}, fmt.Errorf(\"unsupported update field %q\", key)\n\t\t}\n\t\tif !ok {\n\t\t\treturn issueops.IssuePatch{}, fmt.Errorf(\"unsupported value %T for update field %q\", value, key)\n\t\t}\n\t}\n\t// --ephemeral/--persistent/--no-history/--history select one complete\n\t// persistence state. The flag parsing already rejects the contradictory\n\t// pairs; the remaining combinations resolve most-specific-first, which\n\t// reproduces the column pairs the old two-boolean write produced.\n\tswitch {\n\tcase wisp != nil && *wisp:\n\t\tpatch.Persistence = setField(issueops.PersistenceModeEphemeral)\n\tcase noHistory != nil && *noHistory:\n\t\tpatch.Persistence = setField(issueops.PersistenceModeNoHistory)\n\tcase wisp != nil || noHistory != nil:\n\t\tpatch.Persistence = setField(issueops.PersistenceModePersistent)\n\t}\n\treturn patch, nil\n}\n\nfunc stringField(value any) (issueops.Field[string], bool) {","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/update.go#L736-L772","documentation":"buildUpdatePatch (cmd/bd/update.go) recognizes a field key but the supplied value has the wrong Go type (the type assertion like value.(bool) fails), so the field is marked not-ok and this error reports the offending %T and field name. It fires when programmatic callers (or proxied JSON payloads decoded into interface{}) pass, say, a string where a bool or int is required.","triggerScenarios":"Sending {\"no_history\": \"true\"} (string) instead of true (bool) in an update payload; a scripting wrapper marshaling numbers as strings; a proxy client serializing enum-like values as strings where the switch expects a typed value.","commonSituations":"JSON APIs where values arrive as interface{} — JSON has no distinct bool/int typing guarantees if produced loosely; shell scripts building payloads with quoted values; version drift where a field's type changed.","solutions":["Send the value with the expected type: true/false (not \"true\") for boolean fields like no_history, numbers unquoted for numeric fields","Fix the client script to build the payload with native types (e.g. use jq --argjson or language-native JSON encoders)","Check buildUpdatePatch's switch for the exact expected Go type per field and cast/convert before calling","If a type legitimately changed between versions, update the proxy/client to the matching bd version"],"exampleFix":"// before\npayload := `{\"no_history\": \"true\"}`\n// after\npayload := `{\"no_history\": true}`","handlingStrategy":"type-guard","validationCode":"func checkValueTypes(fields map[string]any) error {\n\tfor k, v := range fields {\n\t\tswitch k {\n\t\tcase \"no_history\", \"ephemeral\", \"persistent\":\n\t\t\tif _, ok := v.(bool); !ok {\n\t\t\t\treturn fmt.Errorf(\"field %q must be bool, got %T\", k, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":"func asBool(v any) (bool, bool) {\n\tb, ok := v.(bool)\n\treturn b, ok\n}","tryCatchPattern":"patch, err := buildUpdatePatch(fields)\nif err != nil {\n\tif strings.Contains(err.Error(), \"unsupported value\") {\n\t\t// coerce common string→native conversions and retry once\n\t}\n\treturn err\n}","preventionTips":["Use typed structs (not map[string]any) when constructing update payloads in Go","In JSON, never quote booleans or numbers; use jq --argjson / --jsonargs for raw values","Add schema validation (e.g. JSON Schema) on proxy update endpoints before calling buildUpdatePatch","Write round-trip tests asserting each field's expected Go type"],"tags":["go","cli","type-mismatch","update"],"backgroundTag":"unsupported-field-value-type","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}