{"record":{"id":"d97d972c9f890208","repo":"windmill-labs/windmill","slug":"couldn-t-fetch-resource-types-from-hub-hubbaseur","errorCode":null,"errorMessage":"Couldn't fetch resource types from hub ${hubBaseUrl}: ${(await res1.text())}","messagePattern":"Couldn't fetch resource types from hub (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/hub/hub.ts","lineNumber":75,"sourceCode":"      log.info(\"Using hub API secret\");\n      headers[\"X-api-secret\"] = hubSecret;\n    }\n  }\n\n  if (uid) {\n    headers[\"X-uid\"] = uid;\n  }\n\n  let res1 = await fetch(hubBaseUrl + \"/resource_types/list\", {\n    headers,\n  });\n\n  if (!res1.ok) {\n    if (res1.status === 401) {\n      // 401 can only happen on a private hub\n      throw new Error(\"Unauthorized access to private hub: \" + hubBaseUrl);\n    } else {\n      throw new Error(\n        \"Couldn't fetch resource types from hub \" +\n          hubBaseUrl +\n          \": \" +\n          (await res1.text())\n      );\n    }\n  }\n\n  let list = (await res1.json()) as HubResourceType[];\n\n  if (list && list.length === 0 && hubBaseUrl !== DEFAULT_HUB_BASE_URL) {\n    log.info(\n      \"No resource types found in private hub, fetching from public hub\"\n    );\n    delete headers[\"X-api-secret\"];\n    const res2 = await fetch(DEFAULT_HUB_BASE_URL + \"/resource_types/list\", {\n      headers,\n    });","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/hub/hub.ts#L57-L93","documentation":"The Windmill CLI's hub resource-type pull step fetches a hub's resource-type listing and throws this when the first list HTTP response is not OK (and not a 401, which gets its own message). The error text embeds the hub base URL and the raw response body so the developer can see the server-side reason.","triggerScenarios":"Running 'wmill hub pull' (resource types branch) against a hub whose /resource_types/list returns a non-ok status other than 401: 404 on a wrong hubBaseUrl path, 403 forbidden, 500 server error, or a proxy/auth gateway rejection.","commonSituations":"Pointing --hub at a custom or self-hosted hub URL that doesn't serve the expected API path; hub behind a reverse proxy returning HTML error pages; hub service temporarily down; firewall/corporate proxy intercepting the request.","solutions":["Check the hub URL in the message is reachable and serves /resource_types/list (curl it in a browser)","If using a private hub, verify credentials are set — a 401 is reported separately, so 403/404 usually means wrong URL or missing token scope","Retry if the response body shows a transient 5xx","If behind a corporate proxy, configure proxy env vars so fetch reaches the hub"],"exampleFix":"// before\nawait wmillPull({ hub: \"https://hub.windmill.dev/\" });\n// after\nconst base = \"https://hub.windmill.dev\"; // no trailing slash/path typo\nconst res = await fetch(base + \"/resource_types/list\");\nconsole.log(res.status, await res.text()); // verify before pulling","handlingStrategy":"validation","validationCode":"const res = await fetch(hubBaseUrl + \"/resource_types/list\");\nif (!res.ok) {\n  throw new Error(`Hub ${hubBaseUrl} unreachable: ${res.status} ${await res.text()}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await pullHubResourceTypes(hubBaseUrl);\n} catch (e) {\n  if (String(e).includes(\"Couldn't fetch resource types from hub\")) {\n    console.error(\"Check hub URL/availability:\", hubBaseUrl, e.message);\n  }\n}","preventionTips":["curl the hub's /resource_types/list endpoint before automating pulls","Avoid typos/trailing paths in the hub base URL","Handle corporate proxies by setting HTTP(S)_PROXY env vars","Monitor hub status if pulls are part of CI"],"tags":["network","http","cli","hub"],"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"}