What Happens When a Configuration File Is Missing or Invalid in Continue Dev
When a configuration file is missing or invalid in Continue Dev, the CLI aborts with an error if you provided an explicit path via the --config flag, but automatically falls back to the remote default configuration when no local file exists and the source is not a user-defined assistant.
Continue Dev (continuedev/continue) centralizes its configuration management through a single entry point in the CLI extension. Understanding how the loadConfiguration function handles missing or malformed files helps you troubleshoot startup failures and predict fallback behavior across different deployment scenarios.
Configuration Loading Precedence Chain
The determineConfigSource function in extensions/cli/src/configLoader.ts (lines 84-99) implements a strict priority order for locating configuration files:
- CLI flag (
--config) – highest priority - Saved URI – used when no flag is supplied
- Local
config.yaml– looked for under~/.continue - Remote default config – the built-in fallback
The decision logic checks for the CLI flag first, then verifies the existence of the local file using fs.existsSync, and finally defaults to the remote configuration:
// determineConfigSource (lines 84-99)
if (cliConfigPath) { // 1️⃣ CLI flag
return { type: "cli-flag", path: cliConfigPath };
}
const defaultConfigPath = path.join(env.continueHome, "config.yaml");
if (fs.existsSync(defaultConfigPath)) { // 3️⃣ Local file
return { type: "local-config-yaml" };
}
return { type: "remote-default-config" }; // 4️⃣ Remote default
Missing Configuration File Behavior
The outcome of a missing configuration file depends entirely on the source type determined above.
Explicit CLI Flag with Missing File
When you specify a configuration path via the --config flag that does not exist, the loader treats this as a file path and forwards it to loadConfigYaml. This function calls unrollAssistantWithConfig, which attempts to read the file through the underlying unrollAssistant function from the @continuedev/config-yaml package.
Because the source type is cli-flag, there is no automatic fallback. The file system error propagates back to loadConfiguration, causing the CLI to abort with a "Failed to load config" message.
Absent Local Config Without CLI Flag
If you do not provide a --config flag and ~/.continue/config.yaml does not exist, the loader automatically returns the remote-default-config source type. In this scenario, the system calls loadDefaultConfig to fetch the built-in configuration, allowing the CLI to start without local configuration files.
Invalid Configuration File Handling
When a configuration file exists but contains malformed YAML or JSON, the unrolling process parses and validates the schema during the unrollAssistantWithConfig execution.
Fatal validation errors are collected in unrollResult.errors. If fatal errors exist, loadFromSource re-throws the exception (see the catch block at lines 68-84), causing the CLI to exit. Non-fatal warnings are emitted via console.warn with dimmed formatting (lines 20-25) and allow the CLI to continue executing with the partially valid configuration.
User-Assistant Fallback Exception
The only automatic fallback mechanism for invalid configurations occurs when the source type is user-assistant. If loading a user-provided assistant fails due to invalid definitions, the loader logs a warning and explicitly calls loadDefaultConfig to fall back to the built-in default:
// Fallback for user-assistant (lines 68-84)
if (source.type === "user-assistant") {
console.warn(chalk.yellow("Failed to load user assistants, falling back to default agent"));
return await loadDefaultConfig(...);
}
This behavior does not apply to missing or malformed local files referenced via CLI flags.
Summary
- CLI flag with missing file: Throws error and aborts; no fallback occurs
- No CLI flag and no local config: Automatically loads the remote default configuration via
loadDefaultConfig - Invalid YAML/JSON: Fatal errors abort the CLI; non-fatal warnings allow continuation with logged alerts
- User-assistant failures: Logs warning and falls back to remote default config, unlike CLI-flag sources
- Key file: All logic resides in
extensions/cli/src/configLoader.tswith unrolling handled by@continuedev/config-yaml
Frequently Asked Questions
Does Continue Dev create a default config.yaml automatically?
No, according to the source code in extensions/cli/src/configLoader.ts, if ~/.continue/config.yaml does not exist and no CLI flag is provided, the system loads the remote default configuration directly without creating a local file on disk.
What error message appears when the CLI flag points to a missing file?
The error propagates from the @continuedev/config-yaml package's unrollAssistant function through loadConfiguration, resulting in a "Failed to load config" message that causes the CLI to abort immediately without fallback.
Can I force Continue to use a fallback if my config file is corrupted?
Only if you are loading a user-assistant configuration, which automatically falls back to the default agent after logging a warning. For CLI-specified paths, you must either fix the file or remove the --config flag to trigger the remote default fallback.
Where does Continue look for the local configuration file?
The loader constructs the path using path.join(env.continueHome, "config.yaml"), which typically resolves to ~/.continue/config.yaml on Unix-like systems according to the determineConfigSource implementation.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →