{"record":{"id":"c8ce8814bce9068c","repo":"siyuan-note/siyuan","slug":"clone-attribute-view-text-value-s-failed","errorCode":null,"errorMessage":"clone attribute view text value [%s] failed","messagePattern":"clone attribute view text value \\[(.+?)\\] failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":8192,"sourceCode":"\tvar oldRelationBlockIDs []string\n\tif av.KeyTypeRelation == val.Type {\n\t\tif nil != val.Relation {\n\t\t\tfor _, bID := range val.Relation.BlockIDs {\n\t\t\t\toldRelationBlockIDs = append(oldRelationBlockIDs, bID)\n\t\t\t}\n\t\t}\n\t}\n\tdata, err := gulu.JSON.MarshalJSON(valueData)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"marshal value [%+v] failed: %s\", valueData, err)\n\t\treturn\n\t}\n\tupdatedVal := val\n\t// 文本值先在副本上合并和校验，避免富文本校验失败污染原值，并保留旧客户端的部分更新语义。\n\tif av.KeyTypeText == valueType {\n\t\tupdatedVal = val.Clone()\n\t\tif nil == updatedVal {\n\t\t\terr = fmt.Errorf(\"clone attribute view text value [%s] failed\", valueID)\n\t\t\treturn\n\t\t}\n\t}\n\tif err = gulu.JSON.UnmarshalJSON(data, updatedVal); err != nil {\n\t\tlogging.LogErrorf(\"unmarshal data [%s] failed: %s\", data, err)\n\t\treturn\n\t}\n\tupdatedVal.ID = valueID\n\tupdatedVal.KeyID = keyID\n\tupdatedVal.BlockID = itemID\n\tupdatedVal.Type = valueType\n\tupdatedVal.CreatedAt = valueCreatedAt\n\tif av.KeyTypeText == updatedVal.Type && nil != updatedVal.Text {\n\t\tif nil != oldText && nil != oldText.Rich && !attributeViewTextRichFieldPresent(data) &&\n\t\t\tupdatedVal.Text.Content != oldText.Content {\n\t\t\tupdatedVal.Text.Rich = nil\n\t\t}\n\t\tif err = updatedVal.Text.NormalizeRichContent(); nil != err {","sourceCodeStart":8174,"sourceCodeEnd":8210,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/attribute_view.go#L8174-L8210","documentation":"When updating an attribute view text value, the kernel clones the existing value before merging the incoming JSON so the original is not polluted by failed validation. This error is thrown if val.Clone() returns nil, meaning the source text value could not be cloned and the update cannot proceed safely.","triggerScenarios":"Calling the update-attribute-view-value API for a KeyTypeText column when the in-memory value object is nil or in a state where Clone() yields nil (e.g. corrupted/missing value entry for the given valueID).","commonSituations":"Stale valueID referencing a deleted row value; concurrent deletion during the update; index inconsistency after a failed sync.","solutions":["Re-index or reload the attribute view so the value object exists, then retry","Verify the valueID refers to an existing value of the text key","Recreate the row/value if the underlying data is corrupted"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const val = getValue(avID, keyID, valueID); if (!val) throw new Error(\"value not found: \" + valueID);","typeGuard":null,"tryCatchPattern":"try { await updateValue(data); } catch (e) { if (String(e).includes(\"clone attribute view text value\")) { await reloadAttrView(avID); retryOnce(); } else throw e; }","preventionTips":["Confirm the valueID exists before updating","Avoid concurrent delete+update of the same value","Re-sync/reindex after failed syncs before further edits"],"tags":["attribute-view","clone-failed","internal"],"backgroundTag":"internal-invariant-violation","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}