{"record":{"id":"a2316dc8158d9bde","repo":"yikart/AiToEarn","slug":"responsecode-configeditorconfigpathmissing","errorCode":"ResponseCode.ConfigEditorConfigPathMissing","errorMessage":"ConfigEditorConfigPathMissing","messagePattern":"ConfigEditorConfigPathMissing","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"critical","filePath":"project/aitoearn-backend/libs/config-editor/src/config-editor.config.ts","lineNumber":25,"sourceCode":"    configPath?: string\n  }\n}\n\nexport interface ConfigEditorModuleOptions<T> {\n  schema: ZodDto<T, any> | ZodType\n  config: ConfigEditorSourceConfig\n  routePrefix?: string\n}\n\nexport class ConfigEditorConfig<T> {\n  schema: ZodDto<T, any> | ZodType\n  configPath: string\n  routePrefix: string\n\n  constructor(options: ConfigEditorModuleOptions<T>) {\n    const configPath = options.config.meta?.configPath\n    if (!configPath) {\n      throw new AppException(ResponseCode.ConfigEditorConfigPathMissing)\n    }\n\n    this.schema = options.schema\n    this.configPath = configPath\n    this.routePrefix = (options.routePrefix ?? 'config').replace(/^\\/+|\\/+$/g, '') || 'config'\n  }\n}\n","sourceCodeStart":7,"sourceCodeEnd":33,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/libs/config-editor/src/config-editor.config.ts#L7-L33","documentation":"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.","triggerScenarios":"Registering ConfigEditorModule with a config whose meta is undefined or lacks configPath (e.g. config built programmatically or loaded without meta enrichment).","commonSituations":"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.","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"],"exampleFix":"// before\nConfigEditorModule.register({ config: myConfig, schema: MySchema }) // myConfig.meta?.configPath undefined\n// after\nConfigEditorModule.register({\n  config: { ...myConfig, meta: { ...myConfig.meta, configPath: '/etc/app/config.yaml' } },\n  schema: MySchema,\n})","handlingStrategy":"validation","validationCode":"if (!options.config.meta?.configPath) throw new Error('config must define meta.configPath before registering ConfigEditorModule')","typeGuard":"function hasConfigPath<T>(c: T & { meta?: { configPath?: string } }): c is T & { meta: { configPath: string } } {\n  return typeof c.meta?.configPath === 'string' && c.meta.configPath.length > 0\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["config","bootstrap","configuration","startup"],"backgroundTag":"missing-config-path","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}