{"record":{"id":"c29a68e098f1eb32","repo":"siyuan-note/siyuan","slug":"invalid-card-cover-image","errorCode":null,"errorMessage":"invalid card cover image","messagePattern":"invalid card cover image","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":2065,"sourceCode":"\t}\n\treturn\n}\n\nfunc setAttrViewCardCoverPosition(operation *Operation) (err error) {\n\tdataJSON, err := json.Marshal(operation.Data)\n\tif nil != err {\n\t\treturn\n\t}\n\tvar data setAttrViewCardCoverPositionData\n\tif err = json.Unmarshal(dataJSON, &data); nil != err {\n\t\treturn\n\t}\n\tif !av.IsValidCardCoverSource(data.Source) {\n\t\treturn fmt.Errorf(\"invalid card cover source [%s]\", data.Source)\n\t}\n\tif nil != data.Position {\n\t\tif \"\" == data.Position.Image || 32*1024 < len(data.Position.Image) {\n\t\t\treturn errors.New(\"invalid card cover image\")\n\t\t}\n\t\tif math.IsNaN(data.Position.X) || math.IsInf(data.Position.X, 0) ||\n\t\t\tmath.IsNaN(data.Position.Y) || math.IsInf(data.Position.Y, 0) ||\n\t\t\tdata.Position.X < 0 || 100 < data.Position.X || data.Position.Y < 0 || 100 < data.Position.Y {\n\t\t\treturn fmt.Errorf(\"invalid card cover position [%v, %v]\", data.Position.X, data.Position.Y)\n\t\t}\n\t}\n\n\tattrView, err := av.ParseAttributeView(operation.AvID)\n\tif nil != err {\n\t\treturn\n\t}\n\tif nil == attrView.GetBlockValue(operation.RowID) {\n\t\treturn fmt.Errorf(\"attribute view item [%s] not found\", operation.RowID)\n\t}\n\tview, err := getAttrViewViewByBlockID(attrView, operation.BlockID)\n\tif nil != err {\n\t\treturn","sourceCodeStart":2047,"sourceCodeEnd":2083,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L2047-L2083","documentation":"When setting a card cover position, if a Position object is present its Image field must be a non-empty string of at most 32 KiB. An empty image value or an oversized inline image produces this error. The limit protects the attribute view file from storing huge embedded cover payloads.","triggerScenarios":"doSetAttrViewCardCoverPosition called with data.position present but data.position.image being \"\", or containing an image string (e.g. base64 data URL) longer than 32*1024 characters.","commonSituations":"Plugins embedding full-resolution screenshots as base64 in the position payload; UI code sending an empty image field while positioning an uploaded cover; copy-paste of oversized data URLs.","solutions":["Provide a non-empty image identifier/value, or omit data.position entirely when only the source changes.","Reduce the inline image payload below 32 KiB (resize/compress, or reference an asset by ID instead of inlining).","Store large images as notebook assets and reference them rather than embedding the content in the operation."],"exampleFix":"// before\n{ \"position\": { \"image\": \"\", \"x\": 10, \"y\": 20 } }\n// after\n{ \"position\": { \"image\": \"20240101120000-abcdefg\", \"x\": 10, \"y\": 20 } }","handlingStrategy":"validation","validationCode":"if (position && (typeof position.image !== \"string\" || position.image.length === 0 || position.image.length > 32 * 1024)) throw new Error(\"cover image must be non-empty and <= 32KiB\");","typeGuard":null,"tryCatchPattern":"try { await setCardCoverPosition(...); } catch (e) { if (String(e).includes(\"invalid card cover image\")) fallbackToSourceOnlyUpdate(); else throw e; }","preventionTips":["Reference assets by ID instead of inlining image data","Compress/resize images before embedding if inlining is required","Omit the position object when it is not being changed"],"tags":["attribute-view","card-cover","validation","payload-too-large"],"backgroundTag":"payload-too-large","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"}