usebruno/bruno · error · Error
Invalid item: missing type
Error message
Invalid item: missing type
What it means
`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.
Source
Thrown at packages/bruno-filestore/src/formats/yml/parseItem.ts:72
parsedItemYml.websocket.auth = parsedItemYml.runtime.auth;
}
break;
default:
break;
}
return parsedItemYml;
};
const parseItem = (ymlString: string): BrunoItem => {
try {
const parsedYml = parseYml(ymlString);
const ocItem: Item = ensureAuthV3Rc1BackwardsCompatibility(parsedYml);
const itemType = getItemType(ocItem);
if (!ocItem || !itemType) {
throw new Error('Invalid item: missing type');
}
switch (itemType) {
case 'http':
return parseHttpRequest(ocItem as HttpRequest);
case 'graphql':
return parseGraphQLRequest(ocItem as GraphQLRequest);
case 'grpc':
return parseGrpcRequest(ocItem as GrpcRequest);
case 'websocket':
return parseWebsocketRequest(ocItem as WebSocketRequest);
case 'script':
return parseScript(ocItem as ScriptFile);
View on GitHub (pinned to 9bdd81c7bd)
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.
Example fix
// before
// item file body:
// info:
// name: GetUser
// after
// info:
// name: GetUser
// type: http
// http:
// method: GET
// url: '{{baseUrl}}/users' Defensive patterns
Strategy: validation
Validate before calling
function getItemType(item) {
if (!item) return undefined;
if (item.info && typeof item.info.type === 'string') return item.info.type;
if (typeof item.type === 'string') return item.type;
return undefined;
}
if (!getItemType(parsed)) {
throw new Error('Item file is missing info.type');
} Type guard
function hasItemType(item: unknown): boolean {
if (!item || typeof item !== 'object') return false;
const o = item as any;
return typeof (o.info?.type ?? o.type) === 'string' && (o.info?.type ?? o.type) !== '';
} Try / catch
try { parseItem(yml); }
catch (e) { if (/missing type/.test(e.message)) { /* flag item for repair */ } else throw e; } Prevention
- Always write items with an info.type.
- Use parseFolder for folders, never parseItem.
- Version your item files so schema drift is detectable.
When it happens
Trigger: 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`).
Common situations: 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`.
Related errors
- Unsupported item type: ${itemType}
- Unsupported item type: ${item.type}
- Failed to parse the file – ensure it is valid JSON or YAML
- Invalid workspace: workspace.yml is malformed
- The Collection file is corrupted
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/cee7470dbcd0fe43.
Report an issue: GitHub.