{"record":{"id":"5e8b872c0e3771b3","repo":"Kong/insomnia","slug":"contentinfo-mime-type-in-header-content-type-is-i","errorCode":null,"errorMessage":"contentInfo: mime type in header Content-Type is invalid","messagePattern":"contentInfo: mime type in header Content-Type is invalid","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia-scripting-environment/src/objects/response.ts","lineNumber":111,"sourceCode":"    return '_kind' in obj && obj._kind === 'Response';\n  }\n\n  contentInfo(): ResponseContentInfo {\n    const mimeInfo = {\n      mimeType: 'application/octet-stream',\n      mimeFormat: '', // TODO: it's definition is unknown\n      charset: 'utf8',\n    };\n\n    const contentType = this.headers.find(header => header.key === 'Content-Type');\n    if (contentType) {\n      const directives = contentType.valueOf().split('; ');\n      if (directives.length === 0) {\n        throw new Error('contentInfo: header Content-Type value is blank');\n      } else {\n        const mimeType = directives[0];\n        if (!mimeType) {\n          throw new Error('contentInfo: mime type in header Content-Type is invalid');\n        }\n        mimeInfo.mimeType = mimeType;\n        directives.forEach(dir => {\n          if (dir.startsWith('charset')) {\n            mimeInfo.charset = dir.slice(dir.indexOf('=') + 1);\n          }\n        });\n      }\n    }\n\n    const fileInfo = {\n      extension: '',\n      name: 'unknown',\n    };\n\n    const contentDisposition = this.headers.find(header => header.key === 'Content-Disposition');\n    if (contentDisposition) {\n      const directives = contentDisposition.valueOf().split('; ');","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia-scripting-environment/src/objects/response.ts#L93-L129","documentation":"Validation branch in Response.contentInfo: the first directive of the Content-Type header (the MIME type) failed validation — empty or not a recognizable mime type — so the response's content info cannot be computed from the header.","triggerScenarios":"Thrown at packages/insomnia-scripting-environment/src/objects/response.ts:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the server to send a well-formed Content-Type like application/json","Remove or correct malformed Content-Type headers in the script"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","contentChangedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}