{"record":{"id":"e2fca515b3ff4fe3","repo":"multica-ai/multica","slug":"parse-multica-quick-create-attachment-ids-w","errorCode":null,"errorMessage":"parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w","messagePattern":"parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_issue.go","lineNumber":1062,"sourceCode":"\t\t\tcontinue\n\t\t}\n\t\tif _, ok := seen[v]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[v] = struct{}{}\n\t\tout = append(out, v)\n\t}\n\treturn out\n}\n\nfunc quickCreateAttachmentIDsFromEnv() ([]string, error) {\n\traw := strings.TrimSpace(os.Getenv(\"MULTICA_QUICK_CREATE_ATTACHMENT_IDS\"))\n\tif raw == \"\" {\n\t\treturn nil, nil\n\t}\n\tvar ids []string\n\tif err := json.Unmarshal([]byte(raw), &ids); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w\", err)\n\t}\n\treturn appendUniqueStrings(nil, ids...), nil\n}\n\nfunc runIssueCreate(cmd *cobra.Command, _ []string) error {\n\ttitle, _ := cmd.Flags().GetString(\"title\")\n\tif title == \"\" {\n\t\treturn fmt.Errorf(\"--title is required\")\n\t}\n\tstatusFlag, _ := cmd.Flags().GetString(\"status\")\n\tif statusFlag != \"\" {\n\t\tif err := validateIssueStatus(statusFlag); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tpriorityFlag, _ := cmd.Flags().GetString(\"priority\")\n\tif priorityFlag != \"\" {\n\t\tif err := validateIssuePriority(priorityFlag); err != nil {","sourceCodeStart":1044,"sourceCodeEnd":1080,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_issue.go#L1044-L1080","documentation":"The MULTICA_QUICK_CREATE_ATTACHMENT_IDS environment variable is set to a non-empty value that is not valid JSON for []string — i.e. anything other than a JSON array of strings. json.Unmarshal fails and the raw env var content is implicated in the message. This feeds pre-existing attachment IDs into quick-create, so malformed input fails closed rather than silently dropping attachments.","triggerScenarios":"Exporting MULTICA_QUICK_CREATE_ATTACHMENT_IDS='att1,att2' (comma-separated instead of JSON), '\"att1\"' (a bare string, not an array), '[att1]' (unquoted elements), trailing commas, or a truncated export from shell templating. An unset or whitespace-only variable is fine; only non-empty non-array JSON fails.","commonSituations":"Scripts building the env var by string concatenation instead of a JSON serializer; copying an example with shell-quoting mistakes; multi-line exports with embedded newlines from heredocs.","solutions":["Set the variable to a JSON array of strings: export MULTICA_QUICK_CREATE_ATTACHMENT_IDS='[\"att1\",\"att2\"]'.","When building it dynamically, use jq -c (ids | map(.id) | tojson) or equivalent instead of manual string joining.","Validate before the run: echo \"$MULTICA_QUICK_CREATE_ATTACHMENT_IDS\" | jq -e 'type==\"array\" and all(.; type==\"string\")'.","If you didn't mean to use it, unset the variable entirely."],"exampleFix":"# before\nexport MULTICA_QUICK_CREATE_ATTACHMENT_IDS=\"att1,att2\"\n# after\nexport MULTICA_QUICK_CREATE_ATTACHMENT_IDS='[\"att1\",\"att2\"]'","handlingStrategy":"validation","validationCode":"# validate before every run that sets it\n if [ -n \"${MULTICA_QUICK_CREATE_ATTACHMENT_IDS:-}\" ]; then\n  echo \"$MULTICA_QUICK_CREATE_ATTACHMENT_IDS\" | jq -e 'type==\"array\" and all(.; type==\"string\")' >/dev/null \\\n    || { echo 'MULTICA_QUICK_CREATE_ATTACHMENT_IDS must be a JSON array of strings' >&2; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build the value with a JSON serializer (jq -c) instead of string concatenation.","Prefer passing attachment IDs as CLI flags over the environment when available.","unset the variable when not in use rather than exporting an empty/placeholder string."],"tags":["cli","environment","json","attachments"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}