{"record":{"id":"a4dd20fb621adb9d","repo":"Kong/insomnia","slug":"errname-errmsg","errorCode":null,"errorMessage":"${errName}: ${errMsg}","messagePattern":"\\$\\{errName\\}: \\$\\{errMsg\\}","errorType":"http","errorClass":"ResponseFailError","httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/common/insomnia-fetch.ts","lineNumber":77,"sourceCode":"    if (uri && onDeepLink) {\n      onDeepLink(uri);\n    }\n    const isJson = response.headers.get('content-type')?.includes('application/json') || path.match(/\\.json$/);\n    if (!response.ok) {\n      let errName = `CODE-${response.status}`;\n      let errMsg = response.statusText;\n      if (isJson) {\n        try {\n          const json = await response.json();\n          if (typeof json?.error === 'string') {\n            errName = json.error;\n          }\n          if (typeof json?.message === 'string') {\n            errMsg = json.message;\n          }\n        } catch {}\n      }\n      throw new ResponseFailError(errName, errMsg, response);\n    }\n    return isJson ? response.json() : (response.text() as Promise<T>);\n  } catch (err) {\n    if (!(err instanceof Error)) {\n      throw err;\n    }\n    // AbortSignal.timeout() gives TimeoutError, not AbortError\n    if (err.name === 'AbortError' || err.name === 'TimeoutError') {\n      throw new Error(`insomniaFetch timed out: ${method} ${path}`, { cause: err });\n    }\n    // the real error (ECONNREFUSED, cert problems) hides in err.cause, sometimes nested in an AggregateError\n    const cause = (err as { cause?: string | { code?: string; message?: string; errors?: { code?: string }[] } })\n      .cause;\n    const detail = typeof cause === 'string' ? cause : cause?.code || cause?.errors?.[0]?.code || cause?.message;\n    if (detail) {\n      // fresh Error (don't mutate err.message) so a re-observed/retried error doesn't append the detail twice\n      throw new Error(`${err.message} (${detail})`, { cause: err });\n    }","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/common/insomnia-fetch.ts#L59-L95","documentation":"Error \"${errName}: ${errMsg}\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia/src/common/insomnia-fetch.ts:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}