n8n-io/n8n · error · Error
Workflow ${workflowId} not found in sqlite db
Error message
Workflow ${workflowId} not found in sqlite db What it means
Thrown by getWorkflowJson() when an sqlite3 query against the local workflow_entity table returns no row for the given workflow id. The workflow id is taken from the stored verifier run in eval-results.json, and the script shells out to the `sqlite3` binary with a SELECT by id. An empty result means the workflow that produced the recorded eval run is no longer present in the local n8n sqlite database at the path the script resolved.
Source
Thrown at packages/@n8n/instance-ai/evaluations/export-latest-verifier-request.ts:315
}
function getScenarios(testCase: WorkflowTestCaseJson): Scenario[] {
return testCase.executionScenarios ?? testCase.scenarios ?? [];
}
function getTestCasePrompt(testCase: WorkflowTestCaseJson): string | undefined {
return testCase.conversation?.[0]?.text;
}
function getSerializedTestCaseName(testCase: WorkflowTestCaseJson): string | undefined {
return getTestCasePrompt(testCase)?.slice(0, 70);
}
function getWorkflowJson(workflowId: string): WorkflowJson {
const row = querySqlite(
`select json_object('nodes', json(nodes), 'connections', json(connections)) from workflow_entity where id='${workflowId}';`,
);
if (!row) throw new Error(`Workflow ${workflowId} not found in sqlite db`);
return jsonParse<WorkflowJson>(row);
}
function main(): void {
const args = parseCliArgs(process.argv.slice(2));
const testCase = readJson<WorkflowTestCaseJson>(args.testCasePath);
const scenarios = getScenarios(testCase);
const scenarioName = args.scenarioName ?? scenarios[0]?.name;
if (!scenarioName) throw new Error(`No scenarios found in ${args.testCasePath}`);
const scenario = scenarios.find((item) => item.name === scenarioName);
if (!scenario) throw new Error(`Scenario "${scenarioName}" not found in ${args.testCasePath}`);
const evalResults = readJson<StoredEvalResults<EvalResult>>(evalResultsPath);
const storedTestCase = findStoredTestCaseResult(
evalResults,
args.testCasePath,
getSerializedTestCaseName(testCase),
);
const storedRun = findStoredVerifierRun(storedTestCase, scenarioName);View on GitHub (pinned to 5ac6606e81)
Solutions
- Re-run the workflow eval on the current branch so eval-results.json and the sqlite DB are produced by the same instance.
- Confirm the sqlite DB path the script uses actually contains the workflow id: `sqlite3 <db> "select id from workflow_entity where id='<id>'"`.
- If the DB was lost, point the script at the instance that still has the workflow (correct N8N_USER_FOLDER / copy the DB), or regenerate everything from one fresh eval run.
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the workflow id exists in sqlite before exporting.
import { execFileSync } from 'node:child_process';
function workflowExists(dbPath: string, workflowId: string): boolean {
const out = execFileSync('sqlite3', [dbPath, `select count(*) from workflow_entity where id='${workflowId}';`], { encoding: 'utf8' }).trim();
return Number(out) > 0;
}
if (!workflowExists(sqliteDbPath, storedRun.workflowId)) {
throw new Error(`sqlite DB ${sqliteDbPath} lacks workflow ${storedRun.workflowId}; re-run the workflow evals on this branch.`);
} Prevention
- Always regenerate the sqlite DB and eval-results.json from the same eval run on the same branch.
- Resolve and log the sqliteDbPath at startup so a wrong N8N_USER_FOLDER is obvious.
- Treat a missing workflow id as a signal to re-run evals, not to patch data.
When it happens
Trigger: export-latest-verifier-request runs against a sqlite DB whose workflow_entity table lacks the id stored under the scenario's evalResult. Happens when the DB file points at a different n8n instance than the one that ran the eval, when the workflow was deleted, or when N8N_USER_FOLDER / the DB path resolution selects the wrong file.
Common situations: The eval was recorded against a container/ephemeral instance whose DB was discarded; the local ~/.n8n/database.sqlite was reset; a stale eval-results.json references a workflow from a prior branch; the sqliteDbPath resolution picked the wrong user folder.
Related errors
- eval-results.json does not include a workflowId and evalResu
- Workflow "${workflowId}" not found.
- Cannot publish archived Workflow
- Version "${versionIdToPublish}" not found for workflow "${wo
- Found multiple eval-results entries for test case slug "${sl
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/45cfa5e7efa5fb1f.
Report an issue: GitHub.