From b223a5ef4ab1d9a722b30f2aef09d2b4002e5842 Mon Sep 17 00:00:00 2001 From: myftija Date: Fri, 31 Oct 2025 14:37:55 +0100 Subject: [PATCH 1/2] fix(cli): show a useful error message when config file is missing --- packages/cli-v3/src/config.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/cli-v3/src/config.ts b/packages/cli-v3/src/config.ts index 3e4d27d7a3..5419b2dea6 100644 --- a/packages/cli-v3/src/config.ts +++ b/packages/cli-v3/src/config.ts @@ -22,6 +22,7 @@ import { import { prettyWarning } from "./utilities/cliOutput.js"; import type { InstrumentationModuleDefinition } from "@opentelemetry/instrumentation"; import { builtinModules } from "node:module"; +import { OutroCommandError } from "./cli/common.js"; export type ResolveConfigOptions = { cwd?: string; @@ -162,6 +163,23 @@ async function resolveConfig( ? dirname(packageJsonPath) : cwd; + // `trigger.config` is the fallback value set by c12 + const missingConfigFile = !result.configFile || result.configFile === "trigger.config"; + + if (missingConfigFile) { + const err = new OutroCommandError( + [ + "Couldn't find your trigger.config.ts file.", + "", + "Make sure you are in the directory of your Trigger.dev project, or specify the path to your config file using the `--config ` flag.", + "", + "Alternatively, you can initialize a new project using `npx trigger.dev@latest init`.", + ].join("\n") + ); + err.stack = undefined; + throw err; + } + const config = "config" in result.config ? (result.config.config as TriggerConfig) : result.config; From 1c31d98e29c7479d1aea099de0a4124ca53b0b6b Mon Sep 17 00:00:00 2001 From: myftija Date: Fri, 31 Oct 2025 14:44:59 +0100 Subject: [PATCH 2/2] Add changeset --- .changeset/warm-eagles-itch.md | 5 +++++ packages/cli-v3/src/config.ts | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/warm-eagles-itch.md diff --git a/.changeset/warm-eagles-itch.md b/.changeset/warm-eagles-itch.md new file mode 100644 index 0000000000..f9947954bc --- /dev/null +++ b/.changeset/warm-eagles-itch.md @@ -0,0 +1,5 @@ +--- +"trigger.dev": patch +--- + +Fixed misleading error message in the CLI when config file is missing ("maxDuration" is now required). A useful error message is now shown, including a hint about the `--config` flag. diff --git a/packages/cli-v3/src/config.ts b/packages/cli-v3/src/config.ts index 5419b2dea6..af5623e017 100644 --- a/packages/cli-v3/src/config.ts +++ b/packages/cli-v3/src/config.ts @@ -167,7 +167,7 @@ async function resolveConfig( const missingConfigFile = !result.configFile || result.configFile === "trigger.config"; if (missingConfigFile) { - const err = new OutroCommandError( + throw new OutroCommandError( [ "Couldn't find your trigger.config.ts file.", "", @@ -176,8 +176,6 @@ async function resolveConfig( "Alternatively, you can initialize a new project using `npx trigger.dev@latest init`.", ].join("\n") ); - err.stack = undefined; - throw err; } const config =