{"record":{"id":"26ba48030c7fde7a","repo":"windmill-labs/windmill","slug":"get-path-response-status-body","errorCode":null,"errorMessage":"GET ${path} -> ${response.status}: ${body}","messagePattern":"GET (.+?) -> (.+?): (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/pipeline/pipeline.ts","lineNumber":71,"sourceCode":"// GraphTrigger) are defined in ./localGraph.ts — the canonical pipeline graph\n// module — and shared by the local (wasm-built) and deployed (apiGet) paths.\n//\n// Mirrors the asset-graph endpoint payload (backend/windmill-api-assets).\n// TODO: the checked-in generated client (cli/gen, last regenerated 2025-04)\n// predates these routes, so we raw-fetch and hand-roll the types. Once\n// `cli/gen` is regenerated (run `cli/gen_wm_client.sh`, which is currently\n// >700 openapi.yaml commits stale and would churn the whole client), replace\n// `apiGet` + these types with the generated `wmill.getAssetsGraph(...)`\n// (operationId getAssetsGraph) and `wmill.listPipelineFolders(...)`\n// (operationId listPipelineFolders).\n\nasync function apiGet<T>(path: string): Promise<T> {\n  const response = await fetch(`${OpenAPI.BASE}${path}`, {\n    headers: { Authorization: `Bearer ${OpenAPI.TOKEN}` },\n  });\n  if (!response.ok) {\n    const body = await response.text();\n    throw new Error(`GET ${path} -> ${response.status}: ${body}`);\n  }\n  return (await response.json()) as T;\n}\n\nasync function list(opts: GlobalOptions & { json?: boolean }) {\n  if (opts.json) log.setSilent(true);\n  const workspace = await resolveWorkspace(opts);\n  await requireLogin(opts);\n\n  const items = await apiGet<{ folder: string; script_count: number }[]>(\n    `/w/${workspace.workspaceId}/assets/pipelines`,\n  );\n  if (opts.json) {\n    console.log(JSON.stringify(items));\n  } else if (items.length === 0) {\n    log.info(\n      \"No pipelines in this workspace. Mark scripts with a `// pipeline` comment (plus `// on <spec>` triggers) and push them into a folder.\",\n    );","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/pipeline/pipeline.ts#L53-L89","documentation":"Generic API error thrown by apiGet, the helper behind read-only `wmill pipeline` subcommands (list, show, etc.). Any non-OK response from `GET {OpenAPI.BASE}{path}` is converted into an Error carrying the request path, HTTP status, and response body, replacing the default fetch behavior of silently resolving.","triggerScenarios":"Any `wmill pipeline <subcommand>` where the backend returns 401 (missing/expired token), 404 (unknown pipeline/script path), 400 (malformed path), or 5xx; also when OpenAPI.BASE is misconfigured and hits the wrong host (404/502 from a proxy).","commonSituations":"Running without `wmill auth login` first; pipeline path with a typo or wrong workspace; targeting a self-hosted instance through a reverse proxy that mangles the path; server temporarily down returning 502.","solutions":["Inspect status in the message: 401/403 -> run `wmill auth login` or fix WMILL_TOKEN/workspace.","404 -> verify the pipeline/script path and workspace id (`wmill workspace list`).","Confirm the base URL with curl: `curl -H \"Authorization: Bearer $WMILL_TOKEN\" $WMILL_BASE_URL<path>` to reproduce outside the CLI.","5xx -> check server health/logs, then retry; if behind a proxy, verify it forwards Authorization headers."],"exampleFix":"// before: hitting wrong instance\nwmill pipeline list # -> GET /w/.../pipelines -> 404: ...\n\n// after\nwmill workspace switch <correct-workspace>\nwmill pipeline list","handlingStrategy":"try-catch","validationCode":"// Pre-flight: verify auth and base URL before calling pipeline subcommands\nconst res = await fetch(`${OpenAPI.BASE}/users/me`, {\n  headers: { Authorization: `Bearer ${OpenAPI.TOKEN}` },\n});\nif (!res.ok) throw new Error(`Auth/base-url check failed: ${res.status}`);","typeGuard":null,"tryCatchPattern":"try {\n  const items = await apiGet<Pipeline[]>(`/w/${ws}/pipelines/list`);\n} catch (e: any) {\n  const m = /-> (\\d{3}):/.exec(e.message);\n  switch (m?.[1]) {\n    case \"401\": case \"403\": console.error(\"Run `wmill auth login`\"); break;\n    case \"404\": console.error(\"Unknown path/workspace — check `wmill workspace list`\"); break;\n    default: console.error(\"Server error — check instance health\");\n  }\n  throw e;\n}","preventionTips":["Always `wmill auth login` before scripted use, and verify with `wmill workspace show`.","Quote pipeline paths exactly as shown in the UI (workspace-relative, no leading slash confusion).","Check the base URL points at the intended instance when working with multiple worktrees."],"tags":["network","http","cli"],"backgroundTag":"http-request-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}