Kong/insomnia · error · ResponseFailError
CODE-${error.response.status}
Error message
CODE-${error.response.status} What it means
Error "CODE-${error.response.status}" thrown in Kong/insomnia.
Source
Thrown at packages/insomnia-api/src/spaces.ts:72
}
// `nextUri` is a path like `/v3/users/me/spaces?page[size]=20&page[after]=...`.
// URL needs an absolute base to parse; resolve against the same backend the SDK is configured against.
const url = new URL(nextUri, v3Config.getBaseURL());
return url.searchParams.get('page[after]') ?? undefined;
}
async function readProblemJson(response: Response): Promise<{ title?: string; detail?: string }> {
try {
return await response.clone().json();
} catch {
return {};
}
}
async function mapSdkError(error: unknown): Promise<never> {
if (error instanceof ResponseError) {
const { title, detail } = await readProblemJson(error.response);
throw new ResponseFailError(title || `CODE-${error.response.status}`, detail || error.response.statusText, error.response);
}
throw error;
}
/**
* Lists every space the current user is a member of, paginating through cursors.
*
* TODO: switch callers to true pagination — fetch the first page only and expose
* the cursor so the UI can request more on demand instead of fetching everything
* up front. Requires UI changes to handle progressive loading.
*/
export const getSpaces = async ({ sessionId }: { sessionId: string }): Promise<Space[]> => {
const client = buildClient(sessionId);
const all: Space[] = [];
let pageAfter: string | undefined;
try {
do {
const response: ListCurrentUserSpaces200Response = await client.listCurrentUserSpaces({View on GitHub (pinned to d9bb2b0142)
When it happens
Trigger: Thrown at packages/insomnia-api/src/spaces.ts:72 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/1502ba075624e26b.
Report an issue: GitHub.