multica-ai/multica · error

parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w

Error message

parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w

What it means

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.

Source

Thrown at server/cmd/multica/cmd_issue.go:1062

			continue
		}
		if _, ok := seen[v]; ok {
			continue
		}
		seen[v] = struct{}{}
		out = append(out, v)
	}
	return out
}

func quickCreateAttachmentIDsFromEnv() ([]string, error) {
	raw := strings.TrimSpace(os.Getenv("MULTICA_QUICK_CREATE_ATTACHMENT_IDS"))
	if raw == "" {
		return nil, nil
	}
	var ids []string
	if err := json.Unmarshal([]byte(raw), &ids); err != nil {
		return nil, fmt.Errorf("parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w", err)
	}
	return appendUniqueStrings(nil, ids...), nil
}

func runIssueCreate(cmd *cobra.Command, _ []string) error {
	title, _ := cmd.Flags().GetString("title")
	if title == "" {
		return fmt.Errorf("--title is required")
	}
	statusFlag, _ := cmd.Flags().GetString("status")
	if statusFlag != "" {
		if err := validateIssueStatus(statusFlag); err != nil {
			return err
		}
	}
	priorityFlag, _ := cmd.Flags().GetString("priority")
	if priorityFlag != "" {
		if err := validateIssuePriority(priorityFlag); err != nil {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Set the variable to a JSON array of strings: export MULTICA_QUICK_CREATE_ATTACHMENT_IDS='["att1","att2"]'.
  2. When building it dynamically, use jq -c (ids | map(.id) | tojson) or equivalent instead of manual string joining.
  3. Validate before the run: echo "$MULTICA_QUICK_CREATE_ATTACHMENT_IDS" | jq -e 'type=="array" and all(.; type=="string")'.
  4. If you didn't mean to use it, unset the variable entirely.

Example fix

# before
export MULTICA_QUICK_CREATE_ATTACHMENT_IDS="att1,att2"
# after
export MULTICA_QUICK_CREATE_ATTACHMENT_IDS='["att1","att2"]'
Defensive patterns

Strategy: validation

Validate before calling

# validate before every run that sets it
 if [ -n "${MULTICA_QUICK_CREATE_ATTACHMENT_IDS:-}" ]; then
  echo "$MULTICA_QUICK_CREATE_ATTACHMENT_IDS" | jq -e 'type=="array" and all(.; type=="string")' >/dev/null \
    || { echo 'MULTICA_QUICK_CREATE_ATTACHMENT_IDS must be a JSON array of strings' >&2; exit 1; }
fi

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/e2fca515b3ff4fe3. Report an issue: GitHub.