Mintplex-Labs/anything-llm · error

Invalid runtime setting: ${key}

Error message

Invalid runtime setting: ${key}

What it means

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.

Source

Thrown at collector/utils/runtimeSettings/index.js:76

  parseOptionsFromRequest(request = {}) {
    const options = reqBody(request)?.options?.runtimeSettings || {};
    for (const [key, value] of Object.entries(options)) {
      if (!this.settingConfigs.hasOwnProperty(key)) continue;
      this.set(key, value);
    }
    return;
  }

  /**
   * Get a runtime setting
   * - Will throw an error if the setting requested is not a supported runtime setting key
   * - Will return the default value if the setting requested is not set at all
   * @param {string} key
   * @returns {any}
   */
  get(key) {
    if (!this.settingConfigs[key])
      throw new Error(`Invalid runtime setting: ${key}`);
    return this.settings.hasOwnProperty(key)
      ? this.settings[key]
      : this.settingConfigs[key].default;
  }

  /**
   * Set a runtime setting
   * - Will throw an error if the setting requested is not a supported runtime setting key
   * - Will validate the value against the setting's validate function
   * @param {string} key
   * @param {any} value
   * @returns {void}
   */
  set(key, value = null) {
    if (!this.settingConfigs[key])
      throw new Error(`Invalid runtime setting: ${key}`);
    this.settings[key] = this.settingConfigs[key].validate(value);
  }

View on GitHub (pinned to 526360e320)

Solutions

  1. Check the `settingConfigs` table in collector/utils/runtimeSettings/index.js for the exact allowed keys and fix the typo.
  2. If you intended a new setting, add a `{ default, validate }` entry to `settingConfigs` before reading it.
  3. If the key is optional/dynamic, guard with `Object.hasOwn(settingConfigs, key)` before calling get.
  4. Search the codebase for the misspelled key to find the offending call site.

Example fix

// before
const args = RuntimeSettings.get('browserArgs'); // typo -> throws

// after
const args = RuntimeSettings.get('browserLaunchArgs');
Defensive patterns

Strategy: type-guard

Validate before calling

const RUNTIME_KEYS = ['seenAnyIpWarning', 'allowAnyIp', 'browserLaunchArgs'];
function safeGet(instance, key) {
  if (!RUNTIME_KEYS.includes(key)) {
    throw new Error(`Unsupported runtime setting '${key}'. Known: ${RUNTIME_KEYS.join(', ')}`);
  }
  return instance.get(key);
}

Type guard

function isKnownRuntimeKey(key) {
  return ['seenAnyIpWarning', 'allowAnyIp', 'browserLaunchArgs'].includes(key);
}

Try / catch

try {
  return RuntimeSettings.get(key);
} catch (e) {
  if (/Invalid runtime setting/i.test(e.message)) {
    return undefined; // or a sensible default; this is a programming error, log it
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/bf34ef6aba4c090c. Report an issue: GitHub.