yikart/AiToEarn · critical · AppException
ResponseCode.ConfigEditorConfigPathMissing
ResponseCode.ConfigEditorConfigPathMissing
Error message
ConfigEditorConfigPathMissing
What it means
ConfigEditorConfigPathMissing is thrown in the ConfigEditor factory/constructor when the registered config object has no meta.configPath defined. The config editor needs to know the filesystem path of the config file it reads/writes; without it the module cannot function and fails fast at bootstrap.
Source
Thrown at project/aitoearn-backend/libs/config-editor/src/config-editor.config.ts:25
configPath?: string
}
}
export interface ConfigEditorModuleOptions<T> {
schema: ZodDto<T, any> | ZodType
config: ConfigEditorSourceConfig
routePrefix?: string
}
export class ConfigEditorConfig<T> {
schema: ZodDto<T, any> | ZodType
configPath: string
routePrefix: string
constructor(options: ConfigEditorModuleOptions<T>) {
const configPath = options.config.meta?.configPath
if (!configPath) {
throw new AppException(ResponseCode.ConfigEditorConfigPathMissing)
}
this.schema = options.schema
this.configPath = configPath
this.routePrefix = (options.routePrefix ?? 'config').replace(/^\/+|\/+$/g, '') || 'config'
}
}
View on GitHub (pinned to d3aa8bea5b)
Solutions
- Set meta.configPath on the config passed to ConfigEditorModuleOptions (absolute path to the config file)
- Ensure the config loader attaches meta (e.g. the loadConfig helper) rather than hand-building the object
- If the config genuinely has no file, either provide a writable path for export or don't register the editor for it
- Verify options.config is the enriched config instance, not a plain literal
Example fix
// before
ConfigEditorModule.register({ config: myConfig, schema: MySchema }) // myConfig.meta?.configPath undefined
// after
ConfigEditorModule.register({
config: { ...myConfig, meta: { ...myConfig.meta, configPath: '/etc/app/config.yaml' } },
schema: MySchema,
}) Defensive patterns
Strategy: validation
Validate before calling
if (!options.config.meta?.configPath) throw new Error('config must define meta.configPath before registering ConfigEditorModule') Type guard
function hasConfigPath<T>(c: T & { meta?: { configPath?: string } }): c is T & { meta: { configPath: string } } {
return typeof c.meta?.configPath === 'string' && c.meta.configPath.length > 0
} Prevention
- Always load configs via the loader helper that attaches meta.configPath
- Assert meta.configPath exists in app bootstrap tests
- Never hand-build plain config literals for editor registration
- Document the required meta fields for custom config classes
When it happens
Trigger: Registering ConfigEditorModule with a config whose meta is undefined or lacks configPath (e.g. config built programmatically or loaded without meta enrichment).
Common situations: Custom config class constructed without the meta field; refactor removed meta.configPath; config loaded from a remote source where no file path applies but the editor still requires one; forgot to call the helper that attaches meta.
Related errors
- ResponseCode.ConfigEditorUnsupportedFormat
- InvalidModel
- VideoUploadVidNotFound
- InvalidModel
- InvalidModel
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/a2316dc8158d9bde.
Report an issue: GitHub.