toeverything/AFFiNE · error · InvalidAppConfigInput
invalid_app_config_input
invalid_app_config_input
Error message
Invalid app config input: ${message} What it means
Thrown by ImportConfigCommand after configFactory.validate(forValidation) returns errors — one or more module.key/value entries in the imported JSON file failed server-side config validation. The thrown message aggregates each validation error message separated by newlines.
Solutions
- Read the joined messages in the error — each line names the failing constraint; fix the corresponding module/key/value in the JSON.
- Check the $schema entry at the top of the file (or the published config schema) for the exact module and key names available in your server version.
- Re-export a known-good config from a server of the same version and diff it against your file.
Example fix
// before (config.json)
{
"$schema": "...",
"affine": { "enableDeletedDoc": "yes" }
}
// after
{
"$schema": "...",
"affine": { "enableDeletedDoc": true }
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate against the same factory before saving
const errors = configFactory.validate(forValidation);
if (errors?.length) {
console.error(errors.map(e => e.message).join('\n'));
process.exitCode = 1; // fix file before importing
} Try / catch
try {
await importConfigCommand.execute(path);
} catch (e) {
if (getErrorCode(e) === 'invalid_app_config_input') {
// e.message lists every failing module.key — print and fix the JSON
console.error(e.message);
}
} Prevention
- Validate the config JSON with configFactory.validate (or the published $schema) in CI before import.
- Keep a known-good exported config of the matching server version as the editing baseline.
When it happens
Trigger: Running the config import command with a JSON whose module names or keys don't match known config modules, or whose values fail type/schema validation for that key.
Common situations: Hand-edited config JSON with a typo'd module or key name; values exported from a different AFFiNE version whose config schema changed; JSON numbers where booleans/strings are expected.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- A config file path is required
- Invalid config for module
- ParsingError
- -32001
- A migration name is required
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/ceac6884902e3883.
Report an issue: GitHub.
Appendix: source
Thrown at packages/backend/server/src/data/commands/import.ts:52
}
Object.entries(config).forEach(([key, value]) => {
forValidation.push({
module,
key,
value,
});
forSaving.push({
key: `${module}.${key}`,
value,
});
});
});
const errors = this.configFactory.validate(forValidation);
if (errors?.length) {
throw new InvalidAppConfigInput({
message: errors.map(error => error.message).join('\n '),
});
}
// @ts-expect-error null as user id
await this.models.appConfig.save(null, forSaving);
}
}
View on GitHub (pinned to b4c8548c09)