Kong/insomnia · error · Error

options is not valid: it must be VariableList

Error message

options is not valid: it must be VariableList<Variable> | Variable[] | object

What it means

Type guard at the bottom of rawOptionsToVariables: the options argument is neither a VariableList, an array-like, nor a plain auth-options object keyed by type, so it cannot be converted to Variable lists.

Solutions

  1. Pass one of the documented shapes: VariableList, Variable[], or an object keyed by auth type
  2. Check the script is not passing undefined/null auth options
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/auth.ts:256 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/ccd75fb4ec110efe. Report an issue: GitHub.

Appendix: source

Thrown at packages/insomnia-scripting-environment/src/objects/auth.ts:256

        return optsObjEntry[0] === targetType;
      })
      .map(optsEntry => {
        const optVars = optsEntry[1].map((opt: AuthOption) => {
          return new Variable({
            key: opt.key,
            value: opt.value,
          });
        });
        return new VariableList(undefined, optVars);
      });

    return optsVarLists;
  } else if ('length' in options) {
    // array
    return [new VariableList(undefined, options)];
  }

  throw new Error('options is not valid: it must be VariableList<Variable> | Variable[] | object');
}

export class RequestAuth extends Property {
  private type: AuthOptionTypes;
  private authOptions = new Map<string, VariableList<Variable>>();

  constructor(options: AuthOptions, parent?: Property) {
    super();

    if (!RequestAuth.isValidType(options.type)) {
      throw new Error(`invalid auth type ${options.type}`);
    }

    this.type = options.type;
    const optsObj = options as AuthOptions;
    const optsEntries = Object.entries(optsObj).filter(optsObjEntry => optsObjEntry[0] !== 'type');

    optsEntries

View on GitHub (pinned to d9bb2b0142)