{"record":{"id":"8b144df5bf36e8e6","repo":"windmill-labs/windmill","slug":"could-not-fetch-datatable-schemas-errormessage","errorCode":null,"errorMessage":"Could not fetch datatable schemas: ${errorMessage}","messagePattern":"Could not fetch datatable schemas: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/app/generate_agents.ts","lineNumber":184,"sourceCode":"  if (!fs.existsSync(rawAppPath)) {\n    if (!silent) {\n      log.error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));\n    }\n    return;\n  }\n\n  if (!silent) {\n    log.info(colors.cyan(\"Refreshing agent documentation...\"));\n  }\n\n  // Fetch schemas\n  let schemas: DataTableSchema[] = [];\n  try {\n    schemas = await wmill.listDataTableSchemas({ workspace: workspaceId });\n  } catch (error: unknown) {\n    const errorMessage = error instanceof Error ? error.message : String(error);\n    if (!silent) {\n      log.warn(colors.yellow(`Could not fetch datatable schemas: ${errorMessage}`));\n    }\n  }\n\n  // Read local data configuration from raw_app.yaml\n  let localData: { tables?: string[]; datatable?: string; schema?: string } | undefined;\n  try {\n    const rawApp = (await yamlParseFile(rawAppPath)) as Record<string, unknown>;\n    if (rawApp.data && typeof rawApp.data === \"object\") {\n      localData = rawApp.data as typeof localData;\n    }\n  } catch {\n    // Ignore errors reading raw_app.yaml\n  }\n\n  // Generate and write AGENTS.md\n  const agentsContent = generateAgentsDocumentation(localData);\n  await writeFile(path.join(targetDir, \"AGENTS.md\"), agentsContent, \"utf-8\");\n","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/app/generate_agents.ts#L166-L202","documentation":"regenerateAgentDocs lists datatable schemas via wmill.listDataTableSchemas to document agent data sources. If the API call fails, the warning is logged (unless silent) and docs are generated with an empty schema list.","triggerScenarios":"listDataTableSchemas rejects: bad workspaceId, expired/missing credentials, network error, or the instance not supporting the datatable API.","commonSituations":"Running generate_agents without a logged-in workspace; wrong workspace; older Windmill instance without datatable support; corporate proxy blocking the request.","solutions":["Verify workspace login (wmill workspace current / re-add credentials)","Confirm the workspaceId passed to the function is correct","Check the instance supports datatables and the API route exists","Upgrade the CLI/server if listDataTableSchemas is missing or failing on an older instance"],"exampleFix":"// before\nawait regenerateAgentDocs({ workspaceId: \"wrong-ws\" });\n// after\nawait regenerateAgentDocs({ workspaceId: (await wmill.getCurrentWorkspace()).workspaceId });","handlingStrategy":"fallback","validationCode":"try {\n  await wmill.whoami(); // verify credentials before doc generation\n} catch { console.error('Not authenticated; datatable schema fetch will fail'); }","typeGuard":"function isAxiosishError(e: unknown): e is { response?: { status: number }; message: string } {\n  return typeof e === 'object' && e !== null && 'message' in e;\n}","tryCatchPattern":"try {\n  schemas = await wmill.listDataTableSchemas({ workspace: workspaceId });\n} catch (error: unknown) {\n  const msg = error instanceof Error ? error.message : String(error);\n  if (!silent) log.warn(colors.yellow(`Could not fetch datatable schemas: ${msg}`));\n  schemas = []; // docs generated without datatable section\n}","preventionTips":["Authenticate (wmill workspace add) before running generate_agents","Pass the workspaceId of the active workspace","Confirm the instance version supports the datatable API","Use the silent flag in automated pipelines where the warning is noise"],"tags":["cli","datatable","schema","api"],"backgroundTag":"schema-fetch-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}