multica-ai/multica · error

delete skill file: %w

Error message

delete skill file: %w

What it means

Returned by `multica skill files delete` when DELETE `/api/skills/{id}/files/{fileId}` fails. It takes two positional args (skill ID, file ID) with no client-side format checks; typical causes are 404 for either ID, plus transport/auth/timeout. Note args[1] must be the file's ID, not its path.

Source

Thrown at server/cmd/multica/cmd_skill.go:722

	if output == "json" {
		return cli.PrintJSON(os.Stdout, result)
	}

	fmt.Printf("Skill file upserted: %s (%s)\n", strVal(result, "path"), strVal(result, "id"))
	return nil
}

func runSkillFilesDelete(cmd *cobra.Command, args []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	if err := client.DeleteJSON(ctx, "/api/skills/"+args[0]+"/files/"+args[1]); err != nil {
		return fmt.Errorf("delete skill file: %w", err)
	}

	fmt.Printf("Skill file deleted: %s\n", args[1])
	return nil
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Re-list files and use the ID column: `multica skill files list <skill-id>` → copy ID, not PATH.
  2. If the file is already gone, verify with files list and treat the error as success.
  3. Confirm connectivity/auth if files list itself fails.

Example fix

# before
multica skill files delete sk-1 SKILL.md        # path, not ID

# after
FID=$(multica skill files list sk-1 --output json | jq -r '.[] | select(.path=="SKILL.md") | .id')
multica skill files delete sk-1 "$FID"
Defensive patterns

Strategy: validation

Validate before calling

FID="$(multica skill files list "$SKILL_ID" --output json | jq -r --arg p "$FILE_PATH" '.[] | select(.path==$p) | .id')"
[ -n "$FID" ] || { echo "no file at path $FILE_PATH"; exit 1; }
multica skill files delete "$SKILL_ID" "$FID"

Try / catch

Treat 404-flavored failures as already-deleted in idempotent scripts (exit 0 after verifying with files list); retry only transport/5xx causes. Log the skill ID and file ID pair for audit since deletes are destructive.

Prevention

When it happens

Trigger: Passing the file PATH (e.g. `SKILL.md`) where the FILE ID is expected; deleting an already-deleted file; mistyped skill ID; auth/connectivity failure.

Common situations: Copy `PATH` column from `skill files list` table output instead of the `ID` column; double-delete from a retried script; stale IDs after re-importing a skill (re-import recreates files with new IDs).

Related errors


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