multica-ai/multica · error

rename runtime

Error message

rename runtime: %w

What it means

Wraps the error from client.PatchJSON in runRuntimeRename when PATCH /api/runtimes/{id} with the custom_name (and optional apply_to_machine) fails. Fires on transport, auth, or server rejection; the cause is preserved via %w.

Solutions

  1. Check the server response for details and retry the rename.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/cmd/multica/cmd_runtime.go:275 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at server/cmd/multica/cmd_runtime.go:275

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

	machine, _ := cmd.Flags().GetBool("machine")
	body := map[string]any{"custom_name": args[1]}
	if machine {
		body["apply_to_machine"] = true
	}

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

	var rt map[string]any
	if err := client.PatchJSON(ctx, "/api/runtimes/"+args[0], body, &rt); err != nil {
		return fmt.Errorf("rename runtime: %w", err)
	}

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

	if strings.TrimSpace(args[1]) == "" {
		fmt.Fprintf(os.Stderr, "Custom name cleared; runtime is now %q.\n", strVal(rt, "name"))
	} else {
		fmt.Fprintf(os.Stderr, "Runtime renamed to %q.\n", strVal(rt, "custom_name"))
	}
	return nil
}

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

View on GitHub (pinned to 2c0912b6ec)