{"record":{"id":"0faeef62708e16cf","repo":"siyuan-note/siyuan","slug":"unsupported-parsed-attribute-view-field-s","errorCode":null,"errorMessage":"unsupported parsed attribute view field %s","messagePattern":"unsupported parsed attribute view field (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/apicontract/av_decode.go","lineNumber":168,"sourceCode":"\t\t\tdecoded, err = legacyField[bool](fields, name, \"Boolean\", required)\n\t\t\tvalue.Field(i).SetBool(decoded)\n\t\tcase reflect.Float64:\n\t\t\tvar decoded float64\n\t\t\tdecoded, err = legacyField[float64](fields, name, \"Number\", required)\n\t\t\tvalue.Field(i).SetFloat(decoded)\n\t\tcase reflect.Slice:\n\t\t\tvar entries []json.RawMessage\n\t\t\tentries, err = legacyField[[]json.RawMessage](fields, name, \"Array\", required)\n\t\t\tvar decoded []string\n\t\t\tfor _, entry := range entries {\n\t\t\t\tvar item string\n\t\t\t\tif !bytes.Equal(entry, []byte(\"null\")) && json.Unmarshal(entry, &item) == nil {\n\t\t\t\t\tdecoded = append(decoded, item)\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue.Field(i).Set(reflect.ValueOf(decoded))\n\t\tdefault:\n\t\t\treturn request, fmt.Errorf(\"unsupported parsed attribute view field %s\", name)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn request, err\n\t\t}\n\t}\n\treturn request, nil\n}\n","sourceCodeStart":150,"sourceCodeEnd":176,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/apicontract/av_decode.go#L150-L176","documentation":"avDecodeParsedRequest only supports fields of kind String, Boolean, Number, and Slice. If a request struct declares a field of any other kind (object, map, nested struct), decoding aborts with 'unsupported parsed attribute view field <name>'. This is an internal contract mismatch: the struct schema and the parsed-request decoder are out of sync.","triggerScenarios":"Adding/using an endpoint registered via avDecodeParsedRequest (getAttributeViewPasteRows, getAttributeViewFieldViews, createAttributeViewItem*) whose request struct contains a non-primitive, non-[]string field; typically seen after code changes or plugin-generated requests hitting a struct with unsupported fields.","commonSituations":"Kernel/plugin development where a new typed field (e.g. embedded object) was added to a parsed-request struct without updating the decoder, or building against mismatched kernel versions.","solutions":["Change the request struct field to a supported kind (String, Boolean, Float64, or slice) or register a custom decodeRequest for the endpoint","Update avDecodeParsedRequest to handle the new field kind if the schema genuinely needs it","Report/fix the internal invariant violation if it occurs on an unmodified released kernel"],"exampleFix":"// before\ntype GetAttributeViewPasteRowsRequest struct {\n    AvID string `json:\"avID\" api:\"trim\"`\n    Extra map[string]string `json:\"extra\"` // unsupported kind\n}\n// after\ntype GetAttributeViewPasteRowsRequest struct {\n    AvID string `json:\"avID\" api:\"trim\"`\n    Extra string `json:\"extra\"` // or handle via a dedicated decoder\n}","handlingStrategy":"type-guard","validationCode":"// kernel-side: only String, Boolean, Float64, and slice fields may appear in structs decoded by avDecodeParsedRequest\nconst supportedKinds = new Set([\"string\",\"boolean\",\"number\"]);","typeGuard":"func isParsedAVFieldKind(f reflect.StructField) bool { switch f.Type.Kind() { case reflect.String, reflect.Bool, reflect.Float64, reflect.Slice: return true }; return false }","tryCatchPattern":"if err := decode(req); err != nil { if strings.Contains(err.Error(), \"unsupported parsed attribute view field\") { /* struct schema drifted; fix decoder or struct */ } return err }","preventionTips":["When adding a field to a parsed AV request struct, extend avDecodeParsedRequest in the same change","Run kernel apicontract tests after touching request structs","Keep request DTOs primitive-only or give the endpoint a custom decodeRequest"],"tags":["internal","api","attribute-view","schema"],"backgroundTag":"internal-invariant-violation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}