remix-run/remix · error · AssertionError

throw new AssertionError({ message, actual, expected, operat

Error message

throw new AssertionError({ message, actual, expected, operator })

What it means

`resolveDbConfig` walks up from the cwd via `findAppRoot` looking for `remix.json` and throws when no ancestor directory contains one (and no explicit `context.configPath` was given). Db commands need that config to resolve the `db` section, connection, and migrations.

Source

Thrown at packages/assert/src/lib/expect.ts:200

  /**
   * Awaits the received promise expecting it to reject, then runs the next
   * matcher against the rejection value. Use with `await`.
   */
  rejects: AsyncMatchers
  /**
   * Awaits the received promise expecting it to resolve, then runs the next
   * matcher against the resolved value. Use with `await`.
   */
  resolves: AsyncMatchers
}

export interface Expect {
  (received: unknown): Expectation
  objectContaining<value extends object>(expected: value): value
}

function fail(operator: string, message: string, actual: unknown, expected: unknown): never {
  throw new AssertionError({ message, actual, expected, operator })
}

function createMatchers(received: unknown, negated: boolean): Matchers {
  function check(
    condition: boolean,
    makeMessage: () => string,
    expected: unknown,
    operator: string,
  ) {
    let pass = negated ? !condition : condition
    if (!pass) {
      let prefix = negated ? 'expected not ' : 'expected '
      fail(operator, prefix + makeMessage(), received, expected)
    }
  }

  return {
    toBe(expected) {

View on GitHub (pinned to 9696913134)

Solutions

  1. cd into the directory containing `remix.json` and rerun
  2. Pass an explicit config path if the CLI supports `--config`/`context.configPath`
  3. Verify `remix.json` exists in the app root; create or regenerate it if missing

Example fix

# before
cd ~/projects/monorepo && remix db migrate
# after
cd ~/projects/monorepo/apps/web && remix db migrate
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
import path from 'node:path';
function hasRemixConfig(dir: string): boolean {
  let p = dir;
  while (true) {
    if (fs.existsSync(path.join(p, 'remix.json'))) return true;
    let parent = path.dirname(p);
    if (parent === p) return false;
    p = parent;
  }
}
if (!hasRemixConfig(process.cwd())) throw new Error('Run from the app root');

Prevention

When it happens

Trigger: Running `remix db <command>` from a directory with no `remix.json` in it or any parent, without an explicit config path — `findAppRoot` returns null and the error fires with the cwd-based path in the message.

Common situations: Running from a monorepo root instead of the app directory; missing or misnamed config file; fresh checkout where the app wasn't scaffolded; wrong terminal cwd.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/b9924788e981612c. Report an issue: GitHub.