{"record":{"id":"fb155afdcb20505e","repo":"siyuan-note/siyuan","slug":"unsupported-value-type-s","errorCode":null,"errorMessage":"unsupported value type [%s]","messagePattern":"unsupported value type \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/new_item_template.go","lineNumber":429,"sourceCode":"\t\tvalue.MAsset = assets\n\t\tvalue.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.Checkbox, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil\n\tcase KeyTypeCheckbox:\n\t\tif nil == value.Checkbox {\n\t\t\treturn nil, errors.New(\"checkbox value is missing\")\n\t\t}\n\t\tvalue.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Relation = nil, nil, nil, nil, nil, nil, nil, nil, nil\n\tcase KeyTypeRelation:\n\t\tif nil == value.Relation {\n\t\t\treturn nil, errors.New(\"relation value is missing\")\n\t\t}\n\t\tfor _, blockID := range value.Relation.BlockIDs {\n\t\t\tif !ast.IsNodeIDPattern(blockID) {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid relation block ID [%s]\", blockID)\n\t\t\t}\n\t\t}\n\t\tvalue.Text, value.Number, value.Date, value.MSelect, value.URL, value.Email, value.Phone, value.MAsset, value.Checkbox = nil, nil, nil, nil, nil, nil, nil, nil, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported value type [%s]\", key.Type)\n\t}\n\tvalue.Block, value.Template, value.Created, value.Updated, value.Rollup = nil, nil, nil, nil, nil\n\tvalue.ID = \"\"\n\tvalue.KeyID = \"\"\n\tvalue.BlockID = \"\"\n\tvalue.Type = key.Type\n\tvalue.IsDetached = false\n\tvalue.CreatedAt = 0\n\tvalue.UpdatedAt = 0\n\tvalue.IsRenderAutoFill = false\n\tif nil != value.Number {\n\t\tvalue.Number.Format = key.NumberFormat\n\t\tvalue.Number.FormattedContent = \"\"\n\t}\n\tif nil != value.Date {\n\t\tvalue.Date.FormattedContent = \"\"\n\t}\n\tif nil != value.Created {","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/new_item_template.go#L411-L447","documentation":"normalizeNewItemTemplateValue switches on the attribute-view key's Type; any type not among the supported template value types (text, number, date, select/mSelect, URL, email, phone, mAsset, checkbox, relation) falls through to the default branch and returns 'unsupported value type [%s]'. Types like block, template, created, updated, or rollup are computed fields and cannot be supplied in new-item templates.","triggerScenarios":"Calling PruneInvalidNewItemTemplateFieldValues or normalizeNewItemTemplateFieldValues with a Key whose Type is a computed/rollup type (block, template, created, updated, rollup) or any unrecognized/typo type string.","commonSituations":"Templates that try to preset computed columns; schema migrations introducing a new key type before the template normalizer was updated; typos in type strings in hand-edited templates.","solutions":["Remove the value entry for the computed key type from the template","Only supply values for editable column types (text, number, date, select, URL, email, phone, mAsset, checkbox, relation)","Fix the type string if it is a typo","Extend normalizeNewItemTemplateValue if a new key type must be template-supported"],"exampleFix":"// before\n{\"type\":\"rollup\",\"...}\n// after\n// remove the rollup value; it is computed automatically","handlingStrategy":"validation","validationCode":"switch key.Type {\ncase av.KeyTypeBlock, av.KeyTypeTemplate, av.KeyTypeCreated, av.KeyTypeUpdated, av.KeyTypeRollup:\n    return fmt.Errorf(\"computed type %s cannot be templated\", key.Type)\n}","typeGuard":"func templateable(keyType av.KeyType) bool {\n    switch keyType {\n    case av.KeyTypeText, av.KeyTypeNumber, av.KeyTypeDate, av.KeyTypeSelect, av.KeyTypeMSelect,\n        av.KeyTypeURL, av.KeyTypeEmail, av.KeyTypePhone, av.KeyTypeMAsset, av.KeyTypeCheckbox, av.KeyTypeRelation:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Skip computed columns (block/template/created/updated/rollup) when building templates","Check key.Type against the supported list before emitting a value","Keep key-type constants and the normalizer switch in sync when adding types"],"tags":["attribute-view","validation","enum"],"backgroundTag":"unsupported-enum-value","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"}