nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.58k stars 2.36k forks source link

Unable to set journal_mode: SqliteFailure(Error { code: CannotOpen, extended_code: 14 }, Some("unable to open database file")) #28640

Open wereHamster opened 1 week ago

wereHamster commented 1 week ago

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

Additional Information

No response

njsokol commented 1 week ago

Getting the same thing on Linux. Note that this looks similar to #28608 error

wereHamster commented 1 week ago

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.

wereHamster commented 1 week ago

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…).

Image

wereHamster commented 1 week ago

Alright, regression was introduced in 20.0.4.

bjornharvold commented 1 week ago

Seeing this too

enchorb commented 1 week ago

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

Cammisuli commented 1 week ago

@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.

cpierceworld commented 1 week ago

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

minijus commented 5 days ago

@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.

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.

Cammisuli commented 4 days ago

@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

minijus commented 2 days ago

It seems the issue was addressed with v20.0.7 release.

wereHamster commented 2 days ago

@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.

DaSchTour commented 1 day ago

The issue is still present in 20.0.7 and deleting .nx didn't help :(

Cammisuli commented 1 day ago

@wereHamster are you using Nx Agents?

saurabh-cimpress commented 16 hours ago

For me deleting the .nx folder did help and then command went ahead normally

raulgaf commented 3 hours ago

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 😅

djohnson-aperture commented 2 hours ago

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.