{"record":{"id":"fb7170d8721c3e5b","repo":"siyuan-note/siyuan","slug":"new-item-template-field-s-type-s-is-not-edit","errorCode":null,"errorMessage":"new item template field [%s] type [%s] is not editable","messagePattern":"new item template field \\[(.+?)\\] type \\[(.+?)\\] is not editable","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/new_item_template.go","lineNumber":314,"sourceCode":"\t\treturn ret[i].KeyID < ret[j].KeyID\n\t})\n\treturn\n}\n\nfunc (av *AttributeView) normalizeNewItemTemplateFieldValues(itemTemplate *NewItemTemplate) error {\n\tif 0 == len(itemTemplate.FieldValues) {\n\t\titemTemplate.FieldValues = nil\n\t\treturn nil\n\t}\n\n\tfieldValues := map[string]*NewItemFieldValue{}\n\tfor keyID, fieldValue := range itemTemplate.FieldValues {\n\t\tkey, err := av.GetKey(keyID)\n\t\tif nil != err || nil == key {\n\t\t\treturn fmt.Errorf(\"new item template field [%s] not found\", keyID)\n\t\t}\n\t\tif !isNewItemTemplateEditableKeyType(key.Type) {\n\t\t\treturn fmt.Errorf(\"new item template field [%s] type [%s] is not editable\", keyID, key.Type)\n\t\t}\n\t\tif nil == fieldValue {\n\t\t\tcontinue\n\t\t}\n\t\tif \"\" == fieldValue.Mode {\n\t\t\tfieldValue.Mode = NewItemFieldValueStatic\n\t\t}\n\t\tswitch fieldValue.Mode {\n\t\tcase NewItemFieldValueCurrentTime:\n\t\t\tif KeyTypeDate != key.Type {\n\t\t\t\treturn fmt.Errorf(\"new item template field [%s] current time mode requires date type\", keyID)\n\t\t\t}\n\t\t\tfieldValue.Value = nil\n\t\tcase NewItemFieldValueStatic:\n\t\t\tif nil == fieldValue.Value {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfieldValue.Value, err = normalizeNewItemTemplateValue(fieldValue.Value, key)","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/av/new_item_template.go#L296-L332","documentation":"The referenced key exists but its type is not in the editable whitelist isNewItemTemplateEditableKeyType: only Text, Number, Date, Select, MSelect, URL, Email, Phone, MAsset, Checkbox, and Relation can be templated. System/computed types (Block, Template, Created, Updated, Rollup, Layout) are rejected because they auto-populate or derive their value.","triggerScenarios":"User binds a Rollup or Created/Updated column into a template; UI bug exposes a non-editable column in the template field picker; version skew introducing a new computed type.","commonSituations":"Client allows picking any column; schema migration that turned an editable column into a Rollup; stale template config after a column-type change.","solutions":["Only bind field types returned true by isNewItemTemplateEditableKeyType.","For Created/Updated/etc., omit them from FieldValues — they are filled automatically on row creation.","After a column-type change, re-save the template so the validator can re-check the new type."],"exampleFix":"// before — binding a Rollup column\nFieldValues[\"rollup-key\"] = &av.NewItemFieldValue{...}\n// after — remove it; bind a Text column instead\nFieldValues[\"text-key\"] = &av.NewItemFieldValue{...}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Mirror isNewItemTemplateEditableKeyType (new_item_template.go:459) on the client.\nfunc isEditableKeyType(t av.KeyType) bool {\n    switch t {\n    case av.KeyTypeText, av.KeyTypeNumber, av.KeyTypeDate, av.KeyTypeSelect,\n        av.KeyTypeMSelect, av.KeyTypeURL, av.KeyTypeEmail, av.KeyTypePhone,\n        av.KeyTypeMAsset, av.KeyTypeCheckbox, av.KeyTypeRelation:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Filter the template field picker to editable key types only.","Omit Created/Updated/Block/Rollup/Layout from FieldValues — they auto-populate.","Re-save templates after a column-type change so the validator re-checks."],"tags":["av","new-item-template","field-type","validation","whitelist"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}