windmill-labs/windmill · warning

Could not fetch datatable schemas: ${errorMessage}

Error message

Could not fetch datatable schemas: ${errorMessage}

What it means

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.

Source

Thrown at cli/src/commands/app/generate_agents.ts:184

  if (!fs.existsSync(rawAppPath)) {
    if (!silent) {
      log.error(colors.red(`Error: raw_app.yaml not found in ${targetDir}`));
    }
    return;
  }

  if (!silent) {
    log.info(colors.cyan("Refreshing agent documentation..."));
  }

  // Fetch schemas
  let schemas: DataTableSchema[] = [];
  try {
    schemas = await wmill.listDataTableSchemas({ workspace: workspaceId });
  } catch (error: unknown) {
    const errorMessage = error instanceof Error ? error.message : String(error);
    if (!silent) {
      log.warn(colors.yellow(`Could not fetch datatable schemas: ${errorMessage}`));
    }
  }

  // Read local data configuration from raw_app.yaml
  let localData: { tables?: string[]; datatable?: string; schema?: string } | undefined;
  try {
    const rawApp = (await yamlParseFile(rawAppPath)) as Record<string, unknown>;
    if (rawApp.data && typeof rawApp.data === "object") {
      localData = rawApp.data as typeof localData;
    }
  } catch {
    // Ignore errors reading raw_app.yaml
  }

  // Generate and write AGENTS.md
  const agentsContent = generateAgentsDocumentation(localData);
  await writeFile(path.join(targetDir, "AGENTS.md"), agentsContent, "utf-8");

View on GitHub (pinned to e474e8803c)

Solutions

  1. Verify workspace login (wmill workspace current / re-add credentials)
  2. Confirm the workspaceId passed to the function is correct
  3. Check the instance supports datatables and the API route exists
  4. Upgrade the CLI/server if listDataTableSchemas is missing or failing on an older instance

Example fix

// before
await regenerateAgentDocs({ workspaceId: "wrong-ws" });
// after
await regenerateAgentDocs({ workspaceId: (await wmill.getCurrentWorkspace()).workspaceId });
Defensive patterns

Strategy: fallback

Validate before calling

try {
  await wmill.whoami(); // verify credentials before doc generation
} catch { console.error('Not authenticated; datatable schema fetch will fail'); }

Type guard

function isAxiosishError(e: unknown): e is { response?: { status: number }; message: string } {
  return typeof e === 'object' && e !== null && 'message' in e;
}

Try / catch

try {
  schemas = await wmill.listDataTableSchemas({ workspace: workspaceId });
} catch (error: unknown) {
  const msg = error instanceof Error ? error.message : String(error);
  if (!silent) log.warn(colors.yellow(`Could not fetch datatable schemas: ${msg}`));
  schemas = []; // docs generated without datatable section
}

Prevention

When it happens

Trigger: listDataTableSchemas rejects: bad workspaceId, expired/missing credentials, network error, or the instance not supporting the datatable API.

Common situations: Running generate_agents without a logged-in workspace; wrong workspace; older Windmill instance without datatable support; corporate proxy blocking the request.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/8b144df5bf36e8e6. Report an issue: GitHub.