multica-ai/multica · error

get runtime activity: %w

Error message

get runtime activity: %w

What it means

runRuntimeActivity wraps a failed client.GetJSON to GET /api/runtimes/{args[0]}/activity, which returns hourly activity buckets for a runtime. Same failure family as 654/656: transport error, 401/403/404, or decode failure on the []map[string]any result. The ID is interpolated unescaped, so malformed IDs yield route misses.

Source

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

			strVal(u, "cache_write_tokens"),
		})
	}
	cli.PrintTable(os.Stdout, headers, rows)
	return nil
}

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

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

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

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

	headers := []string{"HOUR", "COUNT"}
	rows := make([][]string, 0, len(activity))
	for _, a := range activity {
		rows = append(rows, []string{
			strVal(a, "hour"),
			strVal(a, "count"),
		})
	}
	cli.PrintTable(os.Stdout, headers, rows)
	return nil
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Verify the runtime ID exists right now with `multica runtime list`.
  2. Re-authenticate / verify base URL if the wrapped error mentions 401 or connection failure.
  3. Align CLI and server versions if /activity is missing on the server.
Defensive patterns

Strategy: try-catch

Try / catch

if err := client.GetJSON(ctx, "/api/runtimes/"+args[0]+"/activity", &activity); err != nil {
	// 404 can mean unknown runtime OR missing endpoint on old servers; check /api/runtimes first
	return fmt.Errorf("get runtime activity: %w", err)
}

Prevention

When it happens

Trigger: Nonexistent or deleted runtime ID (404); no auth or expired token; server without the activity endpoint (older version, 404); unreachable server.

Common situations: Querying activity for a runtime that aged out or was deleted; CLI newer than the deployed server; wrong environment's credentials.

Related errors


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