multica-ai/multica · error
create property: %w
Error message
create property: %w
What it means
Returned by the `multica property create` CLI command when its POST to `/api/properties` fails. The underlying error is wrapped with %w, so the message includes the HTTP layer's detail (connection refused, 4xx/5xx body, auth failure). This is a transport/server-side failure, not local validation.
Source
Thrown at server/cmd/multica/cmd_property.go:333
description, _ := cmd.Flags().GetString("description")
icon, _ := cmd.Flags().GetString("icon")
optionFlags, _ := cmd.Flags().GetStringArray("option")
body := map[string]any{"name": name, "type": propType, "description": description, "icon": icon}
if len(optionFlags) > 0 {
body["config"] = map[string]any{"options": parseOptionFlags(optionFlags, nil)}
}
client, err := newAPIClient(cmd)
if err != nil {
return err
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
var created propertyDTO
if err := client.PostJSON(ctx, "/api/properties", body, &created); err != nil {
return fmt.Errorf("create property: %w", err)
}
output, _ := cmd.Flags().GetString("output")
if output == "json" {
return cli.PrintJSON(os.Stdout, created)
}
fmt.Fprintf(os.Stdout, "Property %q created.\n", created.Name)
printPropertyTable([]propertyDTO{created})
return nil
}
func runPropertyUpdate(cmd *cobra.Command, args []string) error {
client, err := newAPIClient(cmd)
if err != nil {
return err
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
View on GitHub (pinned to 2c0912b6ec)
Solutions
- Verify the server is up and the CLI points at it (check the configured API URL with `multica` config/flags), e.g. hit `/api/health` or run `multica property list`.
- Read the wrapped error text: a 401/403 means re-authenticate the CLI; a 400 means fix the payload (name uniqueness, valid `type`, well-formed `--option` flags).
- If the error is a connection failure, start the server or fix the URL/token, then re-run the same create command.
- For scripted use, capture the error and inspect `errors.Unwrap` / the status code before retrying.
Example fix
// before multica property create --name "Priority" --type select --option "P0" // fails: create property: request failed: 401 unauthorized // after multica auth login # or set correct --api-url / token multica property create --name "Priority" --type select --option "P0"
Defensive patterns
Strategy: try-catch
Validate before calling
# bash: verify server reachability and auth before creating
multica property list >/dev/null 2>&1 || { echo "CLI/server not ready" >&2; exit 1; } Try / catch
if err := runPropertyCreate(cmd, args); err != nil {
var httpErr *cli.HTTPError // if the API client exposes a typed error
if errors.As(err, &httpErr) && httpErr.StatusCode == 401 {
// re-authenticate and retry once
}
return fmt.Errorf("create property: %w", err)
} Prevention
- Smoke-test the CLI target (`multica property list`) before running create commands in scripts.
- Keep the API token fresh; wrap long-running automation with an auth check.
- Treat wrapped errors as structured: unwrap to the status code before deciding to retry.
When it happens
Trigger: Running `multica property create --name X ...` when the multica server is unreachable, the API token is invalid/expired (401), the request body is rejected by the server (400, e.g. duplicate property name or invalid type), or the server returns 5xx.
Common situations: Server not running or wrong `--api-url`/base URL configured; expired CLI token; creating a property with a name that already exists server-side; sending a property `type` the server rejects.
Related errors
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/84e452bfc1bbddfe.
Report an issue: GitHub.