{"record":{"id":"cdc3d25ed23474b2","repo":"semaphoreui/semaphore","slug":"unsupported-kind-v","errorCode":null,"errorMessage":"unsupported kind %v","messagePattern":"unsupported kind (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/project/backup_marshal.go","lineNumber":147,"sourceCode":"\t\tn, ok := toFloat64(data)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"expected number for field, got %T\", data)\n\t\t}\n\t\tv.SetInt(int64(n))\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\tn, ok := toFloat64(data)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"expected number for field, got %T\", data)\n\t\t}\n\t\tv.SetUint(uint64(n))\n\tcase reflect.Float32, reflect.Float64:\n\t\tn, ok := toFloat64(data)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"expected number for field, got %T\", data)\n\t\t}\n\t\tv.SetFloat(n)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported kind %v\", v.Kind())\n\t}\n\treturn nil\n}\n\nfunc toFloat64(data any) (float64, bool) {\n\tswitch n := data.(type) {\n\tcase float64:\n\t\treturn n, true\n\tcase float32:\n\t\treturn float64(n), true\n\tcase int:\n\t\treturn float64(n), true\n\tcase int64:\n\t\treturn float64(n), true\n\tcase int32:\n\t\treturn float64(n), true\n\tcase int16:\n\t\treturn float64(n), true","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/services/project/backup_marshal.go#L129-L165","documentation":"setBasicType (services/project/backup_marshal.go:147) only supports Bool, String, Int*, Uint*, and Float* kinds. If the destination reflect.Value has any other kind (time.Time, custom struct kinds reached here, complex, interface, etc.), it returns \"unsupported kind %v\". Struct/slice/map kinds are handled earlier in unmarshalValueWithBackupTags, so reaching this default indicates an unhandled leaf type.","triggerScenarios":"A backup-tagged field has a kind not covered by setBasicType's switch - e.g. a time.Time value stored directly as a non-struct handling path, a complex128 field, or a custom named type whose kind falls through. Also produced deliberately in Test_SetBasicType_InvalidType_ReturnsError.","commonSituations":"Adding a field of a new type (time.Time, json.RawMessage, custom scalar) to a backup entity struct without extending setBasicType; schema evolution adding fields the unmarshaler does not yet handle.","solutions":["Check which struct field triggered it and either add a case for that reflect.Kind in setBasicType (e.g. special handling for time.Time via string parsing).","Exclude the field from backup processing with a `backup:\"-\"` struct tag.","Change the field to one of the supported basic types (bool, string, int/uint/float).","Pre-process the data so the field is a struct/slice/map (handled by other code paths) rather than an unsupported leaf kind."],"exampleFix":"// before\ntype Env struct {\n    CreatedAt time.Time `backup:\"created\"`\n}\n// after\ntype Env struct {\n    CreatedAt time.Time `backup:\"-\"` // excluded from backup unmarshal\n}","handlingStrategy":"fallback","validationCode":"v := reflect.ValueOf(target).Elem().FieldByName(\"CreatedAt\")\nswitch v.Kind() {\ncase reflect.Bool, reflect.String, reflect.Int, reflect.Float64:\n    // supported\ndefault:\n    return fmt.Errorf(\"field kind %v unsupported by backup unmarshaler\", v.Kind())\n}","typeGuard":"func kindSupported(v reflect.Value) bool {\n    switch v.Kind() {\n    case reflect.Bool, reflect.String, reflect.Int, reflect.Int64, reflect.Uint64, reflect.Float64:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := project.Unmarshal(data, &target); err != nil {\n    if strings.Contains(err.Error(), \"unsupported kind\") {\n        return fmt.Errorf(\"backup unmarshaler does not handle this field type: %w\", err)\n    }\n    return err\n}","preventionTips":["Restrict backup-tagged fields to bool/string/integer/float types.","Tag complex leaf types (time.Time, json.RawMessage) with backup:\"-\" or add explicit handling.","Add a unit test unmarshaling every backup entity struct."],"tags":["go","reflection","unmarshal","unsupported-kind"],"backgroundTag":"unsupported-operation","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}