{"record":{"id":"207ffd359b136f49","repo":"pocketbase/pocketbase","slug":"missing-or-unknown-field-type-in-s","errorCode":null,"errorMessage":"missing or unknown field type in %s","messagePattern":"missing or unknown field type in (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"core/fields_list.go","lineNumber":302,"sourceCode":"type onlyFieldType struct {\n\tType string `json:\"type\"`\n}\n\ntype fieldWithType struct {\n\tField\n\tType string `json:\"type\"`\n}\n\nfunc (fwt *fieldWithType) UnmarshalJSON(data []byte) error {\n\t// extract the field type to init a blank factory\n\tt := &onlyFieldType{}\n\tif err := json.Unmarshal(data, t); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal field type: %w\", err)\n\t}\n\n\tfactory, ok := Fields[t.Type]\n\tif !ok {\n\t\treturn fmt.Errorf(\"missing or unknown field type in %s\", data)\n\t}\n\n\tfwt.Type = t.Type\n\tfwt.Field = factory()\n\n\t// unmarshal the rest of the data into the created field\n\tif err := json.Unmarshal(data, fwt.Field); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal field: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// UnmarshalJSON implements [json.Unmarshaler] and\n// loads the provided json data into the current FieldsList.\nfunc (l *FieldsList) UnmarshalJSON(data []byte) error {\n\tfwts := []fieldWithType{}\n","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/pocketbase/pocketbase/blob/5d217ddb50cb144d80a5d0b0bdf11b52b2c3e457/core/fields_list.go#L284-L320","documentation":"Second failure mode of fieldWithType.UnmarshalJSON: the field JSON is valid, but its \"type\" value does not match any registered field factory in the global Fields registry. PocketBase supports a fixed set of types; anything else (typo, custom unregistered type, or a type from a newer/older version) is rejected.","triggerScenarios":"A field object with type like \"Text\", \"str\", \"image\", or \"geoPoint\" (wrong case/naming), or a type introduced in a newer PocketBase being loaded by an older binary. The full raw field JSON is included in the message.","commonSituations":"Typos in hand-written imports; migrating collection definitions between PocketBase versions where a type was renamed (e.g. older bool/dateTime naming vs modern types); attempting to use a plugin's custom field type without registering it via core.FieldsMap/registerField before loading.","solutions":["Use an exact supported type: text, number, bool, email, url, editor, date, autodate, select, file, relation, json, geoPoint.","If using a custom field type from a plugin, register its factory before any collection load (usually in an app hook at startup).","Re-export the collection from a PocketBase version matching the target to get correct type names."],"exampleFix":"// before\n{\"type\": \"Text\", \"name\": \"title\"} // wrong case\n\n// after\n{\"type\": \"text\", \"name\": \"title\"}","handlingStrategy":"type-guard","validationCode":"var knownFieldTypes = map[string]bool{\n    \"text\": true, \"number\": true, \"bool\": true, \"email\": true,\n    \"url\": true, \"editor\": true, \"date\": true, \"autodate\": true,\n    \"select\": true, \"file\": true, \"relation\": true, \"json\": true,\n    \"geoPoint\": true,\n}","typeGuard":"func isValidFieldType(t string) bool {\n    return knownFieldTypes[t]\n}","tryCatchPattern":"if err := fieldsList.UnmarshalJSON(data); err != nil {\n    if strings.Contains(err.Error(), \"missing or unknown field type\") {\n        // the message embeds the raw field JSON; point the user at its type key\n    }\n}","preventionTips":["Match field type strings exactly (lowercase, camelCase where used, e.g. geoPoint).","Register custom plugin field types before loading collections that use them.","Re-export definitions from the same PocketBase version when porting schemas."],"tags":["json","fields","type-registry","version-compat"],"backgroundTag":null,"analyzedSha":"5d217ddb50cb144d80a5d0b0bdf11b52b2c3e457","analyzedAt":"2026-08-15T10:06:33.165Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}