multica-ai/multica · error

create skill: %w

Error message

create skill: %w

What it means

Returned by `multica skill create` when the HTTP POST /api/skills via client.PostJSON fails. All client-side validation (name, content, config JSON) has already passed, so this is a transport or server-side failure: unreachable server, auth error, or the server rejecting the payload (e.g. duplicate name, validation rules) with a non-2xx status.

Source

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

	}
	if hasContent && content != "" {
		body["content"] = content
	}
	if cmd.Flags().Changed("config") {
		v, _ := cmd.Flags().GetString("config")
		var config any
		if err := json.Unmarshal([]byte(v), &config); err != nil {
			return fmt.Errorf("--config must be valid JSON: %w", err)
		}
		body["config"] = config
	}

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

	var result map[string]any
	if err := client.PostJSON(ctx, "/api/skills", body, &result); err != nil {
		return fmt.Errorf("create skill: %w", err)
	}

	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, result)
	}

	fmt.Printf("Skill created: %s (%s)\n", strVal(result, "name"), strVal(result, "id"))
	return nil
}

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

	body := map[string]any{}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Read the wrapped error for status: 401/403 → `multica login`; 4xx with validation text → fix the payload.
  2. If it's a duplicate, `multica skill list` to find the existing skill and use `multica skill update <id>` instead.
  3. Verify the server is up (`multica daemon status` / health endpoint) for connection failures.
  4. Retry after transient 5xx; check server logs for persistent rejections.

Example fix

# before: blind re-create in a script
multica skill create --name lint --content-file ./s.md
# after: idempotent update-if-exists
id=$(multica skill list --output json | jq -r '.[] | select(.name=="lint") | .id')
[ -n "$id" ] && multica skill update "$id" --content-file ./s.md || multica skill create --name lint --content-file ./s.md
Defensive patterns

Strategy: try-catch

Validate before calling

# Pre-flight auth and connectivity before create
multica auth status >/dev/null 2>&1 || { echo "not authenticated"; exit 2; }
multica skill list >/dev/null 2>&1 || { echo "API unreachable"; exit 2; }

Try / catch

Branch on wrapped cause: 401/403 → re-login; duplicate/validation 4xx → switch to `multica skill update <existing-id>`; connection/5xx → retry with backoff; log the server's message verbatim.

Prevention

When it happens

Trigger: Creating a skill while the server is down or the token is expired; posting a name that collides with an existing skill; server-side schema constraints (name length, reserved keys in config) rejecting the body.

Common situations: Repeated scripted creates without idempotency hitting unique-name rules; self-hosted server behind a proxy with a small body limit; stale auth token after server reinstall.

Related errors


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