{"record":{"id":"2952b6ccf8111ab0","repo":"larksuite/cli","slug":"remove-attachment-token-q-not-found-in-large-att","errorCode":null,"errorMessage":"remove_attachment: token %q not found in large attachment header","messagePattern":"remove_attachment: token %q not found in large attachment header","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/large_attachment_parse.go","lineNumber":300,"sourceCode":"\t}\n\tif headerIdx < 0 {\n\t\treturn fmt.Errorf(\"remove_attachment: draft has no large attachment header\")\n\t}\n\titems, err := decodeLargeAttachmentHeader(snapshot.Headers[headerIdx].Value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"remove_attachment: malformed large attachment header: %w\", err)\n\t}\n\tfiltered := make([]largeAttHeaderEntry, 0, len(items))\n\tremoved := false\n\tfor _, it := range items {\n\t\tif it.token() == token {\n\t\t\tremoved = true\n\t\t\tcontinue\n\t\t}\n\t\tfiltered = append(filtered, it)\n\t}\n\tif !removed {\n\t\treturn fmt.Errorf(\"remove_attachment: token %q not found in large attachment header\", token)\n\t}\n\tif len(filtered) == 0 {\n\t\tsnapshot.Headers = append(snapshot.Headers[:headerIdx], snapshot.Headers[headerIdx+1:]...)\n\t\treturn nil\n\t}\n\tcliItems := make([]struct {\n\t\tID string `json:\"id\"`\n\t}, len(filtered))\n\tfor i, it := range filtered {\n\t\tcliItems[i].ID = it.token()\n\t}\n\tencoded, err := json.Marshal(cliItems)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"remove_attachment: failed to re-encode large attachment header: %w\", err)\n\t}\n\tsnapshot.Headers[headerIdx].Name = LargeAttachmentIDsHeader\n\tsnapshot.Headers[headerIdx].Value = base64.StdEncoding.EncodeToString(encoded)\n\treturn nil","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/large_attachment_parse.go#L282-L318","documentation":"Guard in removeTokenFromIDsHeader: the requested token is not present in the parsed large-attachment header entries, so no entry was removed.","triggerScenarios":"Thrown at shortcuts/mail/draft/large_attachment_parse.go:300 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Refresh the draft (list large attachments) and use a current token"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}