{"record":{"id":"cee7470dbcd0fe43","repo":"usebruno/bruno","slug":"invalid-item-missing-type","errorCode":null,"errorMessage":"Invalid item: missing type","messagePattern":"Invalid item: missing type","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-filestore/src/formats/yml/parseItem.ts","lineNumber":72,"sourceCode":"        parsedItemYml.websocket.auth = parsedItemYml.runtime.auth;\n      }\n      break;\n    default:\n      break;\n  }\n\n  return parsedItemYml;\n};\n\nconst parseItem = (ymlString: string): BrunoItem => {\n  try {\n    const parsedYml = parseYml(ymlString);\n\n    const ocItem: Item = ensureAuthV3Rc1BackwardsCompatibility(parsedYml);\n    const itemType = getItemType(ocItem);\n\n    if (!ocItem || !itemType) {\n      throw new Error('Invalid item: missing type');\n    }\n\n    switch (itemType) {\n      case 'http':\n        return parseHttpRequest(ocItem as HttpRequest);\n\n      case 'graphql':\n        return parseGraphQLRequest(ocItem as GraphQLRequest);\n\n      case 'grpc':\n        return parseGrpcRequest(ocItem as GrpcRequest);\n\n      case 'websocket':\n        return parseWebsocketRequest(ocItem as WebSocketRequest);\n\n      case 'script':\n        return parseScript(ocItem as ScriptFile);\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-filestore/src/formats/yml/parseItem.ts#L54-L90","documentation":"`parseItem` runs the YAML through `ensureAuthV3Rc1BackwardsCompatibility`, then `getItemType`; if the item is falsy or has no resolvable type (`info.type` absent and no root `type`), it throws. The item file could be parsed but is shapeless.","triggerScenarios":"Parsing a `.yml` item file whose parsed value is null/undefined, or whose `info` block lacks `type` and the item has no top-level `type` field (e.g. a ScriptFile without `type`).","commonSituations":"An empty or comment-only item file; a hand-edited item missing the `info.type` field; a partial write/corruption; an item produced by an older/newer schema version that omits `type`; passing a folder file to `parseItem` instead of `parseFolder`.","solutions":["Ensure the item file has `info.type` set to one of `http|graphql|grpc|websocket|script|app` (or root `type: js` for scripts).","If the file is empty/corrupt, restore it from version control.","Route folder files through `parseFolder`, not `parseItem`.","Regenerate the item through Bruno's UI if the schema drifted."],"exampleFix":"// before\n// item file body:\n//   info:\n//     name: GetUser\n\n// after\n//   info:\n//     name: GetUser\n//     type: http\n//   http:\n//     method: GET\n//     url: '{{baseUrl}}/users'","handlingStrategy":"validation","validationCode":"function getItemType(item) {\n  if (!item) return undefined;\n  if (item.info && typeof item.info.type === 'string') return item.info.type;\n  if (typeof item.type === 'string') return item.type;\n  return undefined;\n}\nif (!getItemType(parsed)) {\n  throw new Error('Item file is missing info.type');\n}","typeGuard":"function hasItemType(item: unknown): boolean {\n  if (!item || typeof item !== 'object') return false;\n  const o = item as any;\n  return typeof (o.info?.type ?? o.type) === 'string' && (o.info?.type ?? o.type) !== '';\n}","tryCatchPattern":"try { parseItem(yml); }\ncatch (e) { if (/missing type/.test(e.message)) { /* flag item for repair */ } else throw e; }","preventionTips":["Always write items with an info.type.","Use parseFolder for folders, never parseItem.","Version your item files so schema drift is detectable."],"tags":["filestore","yaml","parsing","schema","typescript"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}