{"record":{"id":"bf34ef6aba4c090c","repo":"Mintplex-Labs/anything-llm","slug":"invalid-runtime-setting-key","errorCode":null,"errorMessage":"Invalid runtime setting: ${key}","messagePattern":"Invalid runtime setting: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/utils/runtimeSettings/index.js","lineNumber":76,"sourceCode":"  parseOptionsFromRequest(request = {}) {\n    const options = reqBody(request)?.options?.runtimeSettings || {};\n    for (const [key, value] of Object.entries(options)) {\n      if (!this.settingConfigs.hasOwnProperty(key)) continue;\n      this.set(key, value);\n    }\n    return;\n  }\n\n  /**\n   * Get a runtime setting\n   * - Will throw an error if the setting requested is not a supported runtime setting key\n   * - Will return the default value if the setting requested is not set at all\n   * @param {string} key\n   * @returns {any}\n   */\n  get(key) {\n    if (!this.settingConfigs[key])\n      throw new Error(`Invalid runtime setting: ${key}`);\n    return this.settings.hasOwnProperty(key)\n      ? this.settings[key]\n      : this.settingConfigs[key].default;\n  }\n\n  /**\n   * Set a runtime setting\n   * - Will throw an error if the setting requested is not a supported runtime setting key\n   * - Will validate the value against the setting's validate function\n   * @param {string} key\n   * @param {any} value\n   * @returns {void}\n   */\n  set(key, value = null) {\n    if (!this.settingConfigs[key])\n      throw new Error(`Invalid runtime setting: ${key}`);\n    this.settings[key] = this.settingConfigs[key].validate(value);\n  }","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/collector/utils/runtimeSettings/index.js#L58-L94","documentation":"Thrown by `RuntimeSettings.get(key)` when `key` is not one of the keys defined in `settingConfigs` (currently `seenAnyIpWarning`, `allowAnyIp`, `browserLaunchArgs`). The class is a singleton sharing per-request collector config, and it intentionally fails closed on unknown keys so typos don't silently read undefined defaults. This is a programming-error throw, not a user-input error.","triggerScenarios":"Calling `RuntimeSettings.get('browserArgs')` (typo for `browserLaunchArgs`); reading a setting that was never registered; a refactor removed a config key but left a read site; passing a dynamically-built key string that doesn't match.","commonSituations":"Renaming a setting key without a grep for all call sites; copy-pasting a key name and misspelling it; adding a new ENV-backed option and forgetting to register its config entry before reading it.","solutions":["Check the `settingConfigs` table in collector/utils/runtimeSettings/index.js for the exact allowed keys and fix the typo.","If you intended a new setting, add a `{ default, validate }` entry to `settingConfigs` before reading it.","If the key is optional/dynamic, guard with `Object.hasOwn(settingConfigs, key)` before calling get.","Search the codebase for the misspelled key to find the offending call site."],"exampleFix":"// before\nconst args = RuntimeSettings.get('browserArgs'); // typo -> throws\n\n// after\nconst args = RuntimeSettings.get('browserLaunchArgs');","handlingStrategy":"type-guard","validationCode":"const RUNTIME_KEYS = ['seenAnyIpWarning', 'allowAnyIp', 'browserLaunchArgs'];\nfunction safeGet(instance, key) {\n  if (!RUNTIME_KEYS.includes(key)) {\n    throw new Error(`Unsupported runtime setting '${key}'. Known: ${RUNTIME_KEYS.join(', ')}`);\n  }\n  return instance.get(key);\n}","typeGuard":"function isKnownRuntimeKey(key) {\n  return ['seenAnyIpWarning', 'allowAnyIp', 'browserLaunchArgs'].includes(key);\n}","tryCatchPattern":"try {\n  return RuntimeSettings.get(key);\n} catch (e) {\n  if (/Invalid runtime setting/i.test(e.message)) {\n    return undefined; // or a sensible default; this is a programming error, log it\n  }\n  throw e;\n}","preventionTips":["Grep for the exact key name before calling get/set.","Register new settings in settingConfigs before reading them.","Keep a single exported list of valid keys and reuse it at call sites."],"tags":["runtime-settings","config","validation","programming-error"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}