{"record":{"id":"a4c929131d62190c","repo":"Kong/insomnia","slug":"expected-single-or-no-entity-in-the-data-store","errorCode":null,"errorMessage":"Expected single or no ${entity} in the data store, but found multiple (${items.length}).","messagePattern":"Expected single or no (.+?) in the data store, but found multiple \\((.+?)\\)\\.","errorType":"exception","errorClass":"InsoError","httpStatus":null,"severity":"error","filePath":"packages/insomnia-inso/src/db/models/util.ts","lineNumber":40,"sourceCode":"    hint?: string;\n  } = {},\n) => ({\n  name: idIsh,\n  message: indent(config.indent || 0, message),\n  value: `${message} - ${idIsh}`,\n  hint: config.hint || `${idIsh}`,\n});\n\nexport const ensureSingleOrNone = <T>(items: T[], entity: string): T | null | undefined => {\n  if (items.length === 1) {\n    return items[0];\n  }\n\n  if (items.length === 0) {\n    return null;\n  }\n\n  throw new InsoError(`Expected single or no ${entity} in the data store, but found multiple (${items.length}).`);\n};\nexport const ensureSingle = <T>(items: T[], entity: string): T => {\n  if (items.length === 1) {\n    return items[0];\n  }\n\n  if (items.length === 0) {\n    throw new InsoError(`Expected single ${entity} in the data store, but found none.`);\n  }\n\n  throw new InsoError(`Expected single ${entity} in the data store, but found multiple (${items.length}).`);\n};\n","sourceCodeStart":22,"sourceCodeEnd":53,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia-inso/src/db/models/util.ts#L22-L53","documentation":"Error \"Expected single or no ${entity} in the data store, but found multiple (${items.length}).\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia-inso/src/db/models/util.ts:40 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"}