Troubleshooting
This page lists known problems, with the text you see, the cause and the fix.
The native HTTP library did not load
Symptom: The app stops at start with this error:
Unsupported operation: dox_http_native did not load: <reason>.
Fix: install Rust (cargo, see https://rustup.rs), then run the app again ...
At build time (dart pub get, dox serve or dox build) you may also see one of these:
dox_http_native: no native library for <os>-<arch>. Install Rust (cargo) to build it from source.
dox_http_native: download dox_http_native-<os>-<arch>.<ext>: 404
dox_http_native: download dox_http_native-<os>-<arch>.<ext> failed: <error>
dox_http_native: sha256 of dox_http_native-<os>-<arch>.<ext> does not match
dox_http_native: cargo build failed
Cause: The package could not find, download or build its native library. Common reasons:
- There was no internet during
dart pub get, or there is no ready build for your OS and CPU. Ready builds exist for macOS arm64 and x64, Linux x64 and arm64, and Windows x64. - Rust is not installed, so the library can not be built from source.
- You compiled with
dart compile exe. It does not run build hooks, so the binary has no native library. - The reason is
native library ABI <x>, expected <y>: the library on disk is from another version of the package.
Fix: Pick one:
- Install Rust with rustup and run
dart pub getagain. Dox then builds the library withcargo. - If the reason is an ABI mismatch and you set
lib_path, rebuild that library: runcargo build --releasein thenativefolder of thedox-http-nativerepo. -
Download the library yourself from the GitHub releases, and point to it in the root
pubspec.yaml: -
Build with
dox build, not withdart compile exe.
The native database drivers load their library the same way. When it does not load, the app stops with:
The fix is the same as above, with the dox-postgres-native or dox-mysql-native repo.
See Native server, Postgres native and MySQL native.
Port already in use
Symptom: At start:
The errno is 48 on macOS and 98 on Linux.
Cause: Another process listens on the port, like an old bin/server.dart or a second copy of the app.
Fix: Find and stop the process, or use another port:
Or set APP_PORT=3001 in .env.
build_runner: conflicting outputs
Symptom: dox build_runner:build, dox serve or dox build stops with a build_runner message that starts with Conflicting outputs were detected, and names files like lib/generated/dtos.g.dart or lib/app/models/user/user.model.g.dart.
Cause: The generated .g.dart files are on disk, but .dart_tool/build does not know them. This happens after a git clone with committed .g.dart files, after deleting .dart_tool, or after a Dart SDK update.
Fix: Delete the build cache and build again:
If that is not enough, delete the .g.dart files that the message names, and build again.
Ambiguous import: Uuid, Name or Schema
Symptom: The analyzer or the build says a name like Uuid, Name, Range, Image or Schema is an "ambiguous import".
Cause: dox_core exports the validation rules (Uuid, Name, Range, Image, ...) and the Schema class. Another import has a class with the same name, like package:uuid. dox_orm also has a Schema class.
Fix: Hide the name you do not use in that file:
import 'package:dox_core/dox_core.dart' hide Uuid;
import 'package:dox_orm/dox_orm.dart' hide Schema;
A .env value with #
A # after a space starts a comment. The comment is not part of the value.
APP_PORT=3000 # dev port -> 3000
DB_PASSWORD=abc#123 -> abc#123 (no space before the #)
DB_PASSWORD="abc # 123" -> abc # 123 (quotes keep the #)
When a value must have # in it (a space, then #), put the value in quotes. The quotes are removed.
Hash.make throws on a long password
Symptom: Saving a user, or registering, gives a 500. The log shows:
Cause: Hash.make() and Hash.makeAsync() use bcrypt, which takes at most 72 bytes. So Dox throws an ArgumentError for a longer password.
Fix: Refuse long passwords in your DTO, before you hash them:
@MaxLength counts characters, not bytes, so a password with non-ASCII characters can still be over 72 bytes. See Hashing.
MySQL 8 login fails
Symptom: The connection to MySQL 8 is refused at login, while the same user works from the mysql client. Often the user was made with the default caching_sha2_password plugin.
Cause: caching_sha2_password needs either TLS or the server RSA public key to send the password. A client that has neither can not log in.
Fix: The Dox MySQL driver supports this plugin. Check these settings of the connection in lib/config/database.dart:
| Setting | What to do |
|---|---|
| Remote host without TLS | Turn on useSSL: true. |
useSSL: true |
The server must have TLS on. |
host, port, user, password |
A wrong value gives the same login error. DB_PORT is 3306 by default for MySQL. |
As a last resort, change the user on the server:
SQLite: the database file
Symptom: An SqliteException with unable to open database file, or an empty database after dox build.
Cause: A relative path starts from the folder where you start the app. After dox build you run the app from build/bundle, where the database is a new empty file. Also, SQLite makes a missing file, but not a missing folder.
Fix:
- Use an absolute path, or make the folder first.
- Set it with
DB_NAME, likeDB_NAME=/var/lib/my_app/dox.sqlite. - Migrations read
DB_DATABASEorDB_NAMEas the path too, so use the same value. - Do not use
:memory:with more than one isolate. Each isolate gets its own empty database.
dox: command not found after dart pub global activate
Symptom:
right after dart pub global activate dox.
Cause: The dox script is in $HOME/.pub-cache/bin, and that folder is not in your path.
Fix: Add it to your shell profile and open a new terminal:
On Windows the folder is %LOCALAPPDATA%\Pub\Cache\bin.
Next steps
- Error index: each message that Dox shows or throws.
- Production checklist: what to check before you deploy.