Kong/insomnia · error · Error

dataURI(): response body is not defined

Error message

dataURI(): response body is not defined

What it means

Error "dataURI(): response body is not defined" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia-scripting-environment/src/objects/response.ts:153

        }
      });
    }

    return {
      mimeType: mimeInfo.mimeType,
      mimeFormat: mimeInfo.mimeFormat,
      charset: mimeInfo.charset,
      fileExtension: fileInfo.extension,
      fileName: fileInfo.name,
      contentType: contentType?.valueOf() || 'application/octet-stream',
    };
  }

  dataURI() {
    const contentInfo = this.contentInfo();
    const bodyInBase64 = this.stream || this.body;
    if (!bodyInBase64) {
      throw new Error('dataURI(): response body is not defined');
    }

    return `data:${contentInfo.contentType};baseg4, ${bodyInBase64}`;
  }

  json(reviver?: (key: string, value: any) => any, _strict?: boolean) {
    // TODO: enable strict after common module is introduced
    try {
      return JSON.parse(this.body.toString(), reviver);
    } catch (e) {
      throw new Error(`json: failed to parse: ${e}`);
    }
  }

  jsonp(_reviver?: (key: string, value: any) => any, _strict?: boolean) {
    throw unsupportedError('jsonp()');
  }

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/response.ts:153 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/1ea69a2e3fc393c9. Report an issue: GitHub.