nx
nx copied to clipboard
Unable to set journal_mode: SqliteFailure(Error { code: CannotOpen, extended_code: 14 }, Some("unable to open database file"))
Current Behavior
nx fails to run on my self-hosted github runners when trying to upgrade from 20.0.3 to 20.0.5 with the error in $SUBJECT. No additional information is printed into the console. Any nx command seems to trigger that, such as nx run-many --target build.
Expected Behavior
Nx works, or at least prints a more useful message (eg. path to the database it's trying to access).
GitHub Repo
No response
Steps to Reproduce
It's a private repository, but I can try to reproduce if you think it'd help. I very much suspect it only affects certain type of self-hosted github runners, as the new version works on my local machine (macOS).
Nx Report
Node : 20.15.1
OS : linux-x64
Native Target : x86_64-linux
pnpm : 9.6.0
nx : 20.0.5
@nx/js : 20.0.5
@nx/eslint : 20.0.5
@nx/workspace : 20.0.5
@nx/devkit : 20.0.5
@nx/esbuild : 20.0.5
@nx/eslint-plugin : 20.0.5
@nx/next : 20.0.5
@nx/react : 20.0.5
@nx/web : 20.0.5
@nx/webpack : 20.0.5
typescript : 5.6.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/next/plugin
Failure Logs
Run npx nx run-many --target build
NX Unable to set journal_mode: SqliteFailure(Error { code: CannotOpen, extended_code: 14 }, Some("unable to open database file"))
Pass --verbose to see the stacktrace.
Error: Process completed with exit code 1.
Package Manager Version
No response
Operating System
- [ ] macOS
- [x] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response
Getting the same thing on Linux. Note that this looks similar to #28608 error
In my case, each github runner has its own workspace and even running under its own user account, so there should not be any cross-workspace conflicts.
The regression was introduced either in 20.0.4 or 20.0.5. I can try to narrow down which one it was. Looking at the changelog, nothing stands out (but there may have been changes not reflected in the changelog…).
Alright, regression was introduced in 20.0.4.
Seeing this too
Was getting this on an M2 Mac Unable to set journal_mode: SqliteFailure(Error { code: SystemIoFailure, extended_code: 522 }, Some("disk I/O error")) after upgrading to 20.0.6 from 20.0.0. After deleting the .nx folder the error went away as per the last comment here https://github.com/nrwl/nx/issues/28424
@wereHamster if you run nx with the env NX_NATIVE_LOGGING=nx::native:db set, you should see where we're trying to open the database from.
Also, if you don't mind pasting the logs with NX_NATIVE_LOGGING here so that I can see the flow. Thank you.
I'm getting a SqliteFailure "DatabaseBusy" error for the same command (after upgrading to NX 20, running on docker/linux). I don't know if it is related... I made a separate ticket since it is a different error code from the OP. https://github.com/nrwl/nx/issues/28665
@wereHamster if you run nx with the env
NX_NATIVE_LOGGING=nx::native:dbset, you should see where we're trying to open the database from.Also, if you don't mind pasting the logs with
NX_NATIVE_LOGGINGhere so that I can see the flow. Thank you.
Setting NX_NATIVE_LOGGING=nx::native:db did not produce any additional logs (running on self hosted Nx Cloud).
We are getting the same error:
NX Unable to set journal_mode: SqliteFailure(Error { code: DatabaseBusy, extended_code: 5 }, Some("database is locked"))
"useLegacyCache": true is set in nx.json.
@minijus make sure to set NX_NATIVE_LOGGING before doing start-ci-run for Nx Cloud. The start command will be the step that collects the env vars to send to agents, not specific nx runs
It seems the issue was addressed with v20.0.7 release.
@Cammisuli setting that env. variable does not show any logs. I set it via env: top-level option in the github workflow so it's set when any job runs. And issue is still present in 20.0.7.
The issue is still present in 20.0.7 and deleting .nx didn't help :(
@wereHamster are you using Nx Agents?
For me deleting the .nx folder did help and then command went ahead normally
Not sure if this is a fix, but for us the issue was on the yarnrc.yml file.
We recently migrated to yarn berry (3.6.4) for one of our projects to use yarn workspaces & Lerna. But sometimes we need to go back to yarn classic since other projects do not support that version yet.
Anyways, we noticed that switching between versions will add the yarnPath config to the.yarnrc.yml file.
After we removed that config lerna was working as expected. 🤷♂
Not sure if this is related with lerna or nx but hopefully this helps someone with the same issue 😅
Chiming in. I was using a clean clone of a repo. I'd ask if anyone here is using the VS Code Nx Console (nrwl.angular-console) extension? I think it does something to mess up the cache during that initial loading of the workspace in VS Code.
Doing the clone and initial setup in a basic terminal seemed to get me past the point where things could get mangled.
Deleting the .nx folder does help, but its merely a temporary solution, error happens again eventually, and then you need to delete .nx folder again.
Same issue here (on a Mac) after migrating from angular 17 to 18. and nx is on version 20.0.11.
Deleting .nx folder or calling nx reset or nx repair isn't helping
deleting in web storm didn't work. After retrying with rm -rf .nx its working
Folks here, can we try the latest version of Nx (20.0.12) to see if this is still reproducible?
Folks here, can we try the latest version of Nx (20.0.12) to see if this is still reproducible?
Upgraded to 20.0.12 today and using github actions with namespace runners I am still getting the error
Full stack trace with --verbose
Run pnpm nx affected -t=test --base=origin/main --head=HEAD --exclude='tag:type:integration' --shard=2/2 --bail=1 --silent=true --verbose
Error: Unable to set journal_mode: DB pragma update error: SqliteFailure(Error { code: CannotOpen, extended_code: 14 }, Some("unable to open database file"))
at /home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/utils/db-connection.js:12:93
at getEntryOrSet (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/utils/db-connection.js:26:17)
at getDbConnection (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/utils/db-connection.js:12:24)
at getTaskDetails (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/hasher/hash-task.js:19:84)
at invokeTasksRunner (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/tasks-runner/run-command.js:367:56)
at runCommandForTasks (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/tasks-runner/run-command.js:117:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/tasks-runner/run-command.js:105:29
at async handleErrors (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/utils/handle-errors.js:9:24)
at async runCommand (/home/runner/work/XXX/frontendnx/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]__xbjtr5ucvm2hspey2expj3735e/node_modules/nx/src/tasks-runner/run-command.js:104:20)
@kaylesworth lets try 20.0.13 now 🙂 thanks for your help!
@kaylesworth lets try 20.0.13 now 🙂 thanks for your help!
@Cammisuli can confirm that it works in 20.0.13!
We updated to the latest Nx v20.1.0 and still get an SqliteFailureError in our build:
NX DB transaction operation error: SqliteFailure(Error { code: DatabaseBusy, extended_code: 5 }, Some("database is locked"))
These errors started to occurr for us since Nx v20.0.4
@tFaster where is this happening for you? Local dev machine? (macOS, Linux, Windows?). If locally do you have Nx Console installed? Or was this happening CI? Can you give me more details on what was happening before?
For me it works on v20.1.0
v20.1.0 not works for me, in macOS, without nx console (well I even do not know what’s it).
I’m off computer, I will provide more details later
my nx.json:
{
"useDaemonProcess": true,
"targetDefaults": {
"dev": {
"dependsOn": ["^build"]
},
"build": {
"dependsOn": ["^build", "check"]
},
"deploy": {
"dependsOn": ["build", "^build", "check"]
},
"start": {
"dependsOn": ["build", "^build"]
},
"check": {
"dependsOn": ["^build"]
}
}
}
run nx, got the following error:
nx dev xxx
NX Running target dev for project xxx and 8 tasks it depends on:
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Daemon process terminated and closed the connection
Please rerun the command, which will restart the daemon.
If you get this error again, check for any errors in the daemon process logs found in: /xxx/.nx/workspace-data/d/daemon.log
ELIFECYCLE Command failed with exit code 1.
Process finished with exit code 1
daemon.log:
[NX Daemon Server] - 2024-11-13T16:00:47.171Z - Handled HASH_TASKS. Handling time: 16. Response time: 0.
<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/utils/db-connection.js:12
const connection = getEntryOrSet(dbConnectionMap, key, () => (0, native_1.connectToNxDb)(opts.directory, package_json_1.version, opts.dbName));
^
Error: Unable to set journal_mode: DB pragma update error: SqliteFailure(Error { code: CannotOpen, extended_code: 14 }, Some("unable to open database file"))
at <my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/utils/db-connection.js:12:93
at getEntryOrSet (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/utils/db-connection.js:26:17)
at getDbConnection (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/utils/db-connection.js:12:24)
at new TaskHistory (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/utils/task-history.js:11:91)
at getTaskHistory (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/utils/task-history.js:48:23)
at handleGetEstimatedTaskTimings (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/handle-task-history.js:24:59)
at <my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:146:141
at handleResult (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:172:22)
at handleMessage (<my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:146:15)
at <my project dir>/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/nx/src/daemon/server/server.js:72:15 {
code: 'GenericFailure'
}
Getting the same. Intel Mac ATM. NMX 19 and 20. Quite a persistent error. Usually have to run commands exactly three times to resolve the issue. Not sure why exactly three. The first two fail, third succeeds. Does not seem to matter how much time passes between runs. I can run three times in a row as fast as I can, or wait minutes between each. Always fails the first two, succeeds the third.