{"record":{"id":"7d588e6202c2c915","repo":"windmill-labs/windmill","slug":"could-not-fetch-datatables-errormessage","errorCode":null,"errorMessage":"Could not fetch datatables: ${errorMessage}","messagePattern":"Could not fetch datatables: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/app/new.ts","lineNumber":313,"sourceCode":"    log.info(colors.gray(\"Fetching available datatables...\"));\n    datatables = await wmill.listDataTables({ workspace: workspaceId });\n\n    if (datatables.length > 0) {\n      // Fetch schemas for all datatables\n      const schemaData = await wmill.listDataTableSchemas({\n        workspace: workspaceId,\n      });\n      for (const dt of schemaData) {\n        if (dt.schemas && !dt.error) {\n          const schemaNames = Object.keys(dt.schemas);\n          datatableSchemas.set(dt.datatable_name, schemaNames);\n        }\n      }\n    }\n  } catch (error: unknown) {\n    const errorMessage =\n      error instanceof Error ? error.message : String(error);\n    log.warn(\n      colors.yellow(`Could not fetch datatables: ${errorMessage}`)\n    );\n  }\n\n  // Ask for summary (skipped if --summary is provided)\n  let summary: string;\n  if (opts.summary !== undefined) {\n    if (opts.summary.trim().length === 0) {\n      log.error(colors.red(\"--summary cannot be empty\"));\n      return;\n    }\n    summary = opts.summary;\n  } else {\n    summary = await Input.prompt({\n      message: \"App summary (short description):\",\n      minLength: 1,\n      validate: (value: string) => {\n        if (value.trim().length === 0) {","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/app/new.ts#L295-L331","documentation":"This is a non-fatal warning from `wmill app new` (newApp). While scaffolding a raw app the CLI fetches the workspace's datatables and their schemas via wmill.listDataTables/listDataTableSchemas purely to power the interactive datatable picker. If that API call fails for any reason (network, auth, API error), the CLI catches the error, prints this warning with the underlying message, and continues with an empty datatable list instead of aborting the app creation.","triggerScenarios":"Calling `wmill app new` (interactive or with flags) when wmill.listDataTables({workspace}) or wmill.listDataTableSchemas({workspace}) throws: e.g. the workspace backend is unreachable, the stored token is expired/invalid, the workspace lacks the datatables feature (EE-only), or the API returns an error response.","commonSituations":"Running against a self-hosted instance without the datatables enterprise feature; stale WM_TOKEN after token rotation; offline/VPN-down laptop; pointing at the wrong instance URL so /datatables endpoints 404; temporary backend restart while scaffolding.","solutions":["Verify connectivity and credentials: run `wmill workspace show` / any other command against the same workspace to confirm auth and instance URL work.","Check that the instance has datatables enabled (enterprise feature); if not, ignore the warning and configure a datatable later or via --datatable only when the feature exists.","Re-login (`wmill login`) or refresh the token if the API returned 401/403.","Retry the command once the backend is reachable; the warning is transient-safe and app creation still proceeds."],"exampleFix":"// before: only the CLI's own handling\nlog.warn(colors.yellow(`Could not fetch datatables: ${errorMessage}`));\n// after (caller-side): pre-check the API before running app new\ntry { await wmill.listDataTables({ workspace }); } catch (e) {\n  console.error('Datatables API unavailable, fix auth/instance first:', e.message);\n  process.exit(1); // or proceed knowing the picker will be empty\n}","handlingStrategy":"fallback","validationCode":"let datatablesOk = true;\ntry { await wmill.listDataTables({ workspace }); } catch { datatablesOk = false; }\nif (!datatablesOk) console.warn('Datatable picker will be empty; fix auth/instance before relying on --datatable.');","typeGuard":"function isApiError(e: unknown): e is Error & { statusCode?: number } {\n  return e instanceof Error;\n}","tryCatchPattern":"try {\n  datatables = await wmill.listDataTables({ workspace });\n} catch (error) {\n  const msg = error instanceof Error ? error.message : String(error);\n  log.warn(`Datatables unavailable (continuing without): ${msg}`);\n  datatables = []; // explicit fallback so downstream code sees a defined state\n}","preventionTips":["Verify workspace auth (`wmill workspace show`) before running scaffolding commands in CI.","Confirm your instance supports datatables (EE feature) before scripting --datatable usage.","Run wmill commands on a machine with confirmed connectivity to the instance URL.","Treat this warning as expected when datatables are intentionally disabled; don't wrap app new in code that retries on it."],"tags":["cli","api-call-failed","datatables","non-fatal"],"backgroundTag":"api-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"}