{"record":{"id":"b9924788e981612c","repo":"remix-run/remix","slug":"throw-new-assertionerror-message-actual-expect","errorCode":null,"errorMessage":"throw new AssertionError({ message, actual, expected, operator })","messagePattern":"throw new AssertionError\\((.+?)\\)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"packages/assert/src/lib/expect.ts","lineNumber":200,"sourceCode":"  /**\n   * Awaits the received promise expecting it to reject, then runs the next\n   * matcher against the rejection value. Use with `await`.\n   */\n  rejects: AsyncMatchers\n  /**\n   * Awaits the received promise expecting it to resolve, then runs the next\n   * matcher against the resolved value. Use with `await`.\n   */\n  resolves: AsyncMatchers\n}\n\nexport interface Expect {\n  (received: unknown): Expectation\n  objectContaining<value extends object>(expected: value): value\n}\n\nfunction fail(operator: string, message: string, actual: unknown, expected: unknown): never {\n  throw new AssertionError({ message, actual, expected, operator })\n}\n\nfunction createMatchers(received: unknown, negated: boolean): Matchers {\n  function check(\n    condition: boolean,\n    makeMessage: () => string,\n    expected: unknown,\n    operator: string,\n  ) {\n    let pass = negated ? !condition : condition\n    if (!pass) {\n      let prefix = negated ? 'expected not ' : 'expected '\n      fail(operator, prefix + makeMessage(), received, expected)\n    }\n  }\n\n  return {\n    toBe(expected) {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/assert/src/lib/expect.ts#L182-L218","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["cd into the directory containing `remix.json` and rerun","Pass an explicit config path if the CLI supports `--config`/`context.configPath`","Verify `remix.json` exists in the app root; create or regenerate it if missing"],"exampleFix":"# before\ncd ~/projects/monorepo && remix db migrate\n# after\ncd ~/projects/monorepo/apps/web && remix db migrate","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nfunction hasRemixConfig(dir: string): boolean {\n  let p = dir;\n  while (true) {\n    if (fs.existsSync(path.join(p, 'remix.json'))) return true;\n    let parent = path.dirname(p);\n    if (parent === p) return false;\n    p = parent;\n  }\n}\nif (!hasRemixConfig(process.cwd())) throw new Error('Run from the app root');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["cd to the app root before db commands","Verify remix.json exists in CI checkout steps","Use explicit config paths in monorepos"],"tags":["cli","database","config","file-not-found"],"backgroundTag":"config-file-not-found","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}