{"record":{"id":"517a54cc7f603a9e","repo":"larksuite/cli","slug":"add-inline-requires-path","errorCode":null,"errorMessage":"add_inline requires path","messagePattern":"add_inline requires path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":324,"sourceCode":"\t\t}\n\t\tif strings.ContainsAny(op.Value, \"\\r\\n\") {\n\t\t\treturn fmt.Errorf(\"set_header: header value must not contain CR or LF\")\n\t\t}\n\tcase \"remove_header\":\n\t\tif strings.TrimSpace(op.Name) == \"\" {\n\t\t\treturn fmt.Errorf(\"remove_header requires name\")\n\t\t}\n\tcase \"add_attachment\":\n\t\tif strings.TrimSpace(op.Path) == \"\" {\n\t\t\treturn fmt.Errorf(\"add_attachment requires path\")\n\t\t}\n\tcase \"remove_attachment\":\n\t\tif !op.Target.hasAnyKey() {\n\t\t\treturn fmt.Errorf(\"remove_attachment requires target with at least one of part_id, cid, or token\")\n\t\t}\n\tcase \"add_inline\":\n\t\tif strings.TrimSpace(op.Path) == \"\" {\n\t\t\treturn fmt.Errorf(\"add_inline requires path\")\n\t\t}\n\t\tif strings.TrimSpace(op.CID) == \"\" {\n\t\t\treturn fmt.Errorf(\"add_inline requires cid\")\n\t\t}\n\tcase \"replace_inline\":\n\t\tif !op.Target.hasKey() {\n\t\t\treturn fmt.Errorf(\"replace_inline requires target with at least one of part_id or cid\")\n\t\t}\n\t\tif strings.TrimSpace(op.Path) == \"\" {\n\t\t\treturn fmt.Errorf(\"replace_inline requires path\")\n\t\t}\n\tcase \"remove_inline\":\n\t\tif !op.Target.hasKey() {\n\t\t\treturn fmt.Errorf(\"remove_inline requires target with at least one of part_id or cid\")\n\t\t}\n\tcase \"insert_signature\":\n\t\tif strings.TrimSpace(op.SignatureID) == \"\" {\n\t\t\treturn fmt.Errorf(\"insert_signature requires signature_id\")","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L306-L342","documentation":"An `add_inline` operation embeds an inline image/file into the draft body and therefore needs both a local file to upload (`path`) and a content ID (`cid`) to reference it from HTML. The validator rejects the op when `path` is missing, empty, or whitespace-only.","triggerScenarios":"Submitting `{\"op\":\"add_inline\",\"cid\":\"img1\"}` without `path`, or with `path: \"\"` / whitespace only.","commonSituations":"Generated op lists where the image file path variable was empty; omitting path because remove_inline/replace_inline targets use cid-based identification and were confused with add_inline requirements.","solutions":["Add a non-empty `path` field to the add_inline operation pointing at the file to embed","Ensure the cid is also set (add_inline requires both path and cid)","Verify the path source (config/env/glob) actually produced a value before building the op"],"exampleFix":"// before\n{\"op\":\"add_inline\",\"cid\":\"logo1\"}\n// after\n{\"op\":\"add_inline\",\"cid\":\"logo1\",\"path\":\"/tmp/logo.png\"}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(op.Path) == \"\" {\n    return fmt.Errorf(\"add_inline requires path\")\n}","typeGuard":"func hasAddInlinePath(op DraftOp) bool { return strings.TrimSpace(op.Path) != \"\" }","tryCatchPattern":null,"preventionTips":["Provide both path and cid for every add_inline op","Verify file path variables are non-empty before building the op list","Do not confuse add_inline requirements with remove_inline (target-only)"],"tags":["validation","mail","draft","inline-image","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}