{"record":{"id":"713def0ee583429a","repo":"usebruno/bruno","slug":"the-collection-file-is-corrupted","errorCode":null,"errorMessage":"The Collection file is corrupted","messagePattern":"The Collection file is corrupted","errorType":"exception","errorClass":"BrunoError","httpStatus":null,"severity":"error","filePath":"packages/bruno-app/src/utils/importers/common.js","lineNumber":28,"sourceCode":"import { BrunoError } from 'utils/common/error';\nimport { isOpenApiSpec } from './openapi-collection';\nimport { isPostmanCollection } from './postman-collection';\nimport { isInsomniaCollection } from './insomnia-collection';\nimport { valueToString } from '@usebruno/common/utils';\n\nexport const validateSchema = async (collections = []) => {\n  collections = Array.isArray(collections) ? collections : [collections];\n\n  try {\n    await Promise.all(\n      collections.map(async (collection) => {\n        await collectionSchema.validate(collection);\n      })\n    );\n    return collections;\n  } catch (err) {\n    console.log(err);\n    throw new BrunoError('The Collection file is corrupted');\n  }\n};\n\nexport const updateUidsInCollection = (_collection) => {\n  const collection = cloneDeep(_collection);\n\n  collection.uid = uuid();\n\n  const updateItemUids = (items = []) => {\n    each(items, (item) => {\n      item.uid = uuid();\n\n      each(get(item, 'request.headers'), (header) => (header.uid = uuid()));\n      each(get(item, 'request.params'), (param) => (param.uid = uuid()));\n      each(get(item, 'request.vars.req'), (v) => (v.uid = uuid()));\n      each(get(item, 'request.vars.res'), (v) => (v.uid = uuid()));\n      each(get(item, 'request.assertions'), (a) => (a.uid = uuid()));\n      each(get(item, 'request.body.multipartForm'), (param) => (param.uid = uuid()));","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-app/src/utils/importers/common.js#L10-L46","documentation":"Thrown by validateSchema() after collectionSchema.validate() rejects one or more collections. It is a deliberately generic message — the underlying Yup schema error is only console.log-ged, not surfaced — signalling the imported collection does not match Bruno's collection schema.","triggerScenarios":"Importing a collection (OpenAPI, Insomnia, OpenCollection, Postman) whose converted Bruno shape fails collectionSchema validation: missing required fields, wrong item types, malformed request/response objects, etc.","commonSituations":"A converter produced an incomplete collection, an upstream spec had exotic structures the converter does not handle, or a hand-edited import file drifted from the schema after a Bruno version bump.","solutions":["Reproduce in a console to read the real Yup error logged by validateSchema (the thrown message hides it).","Fix the offending field named in the Yup validation error in the source spec or converter output.","Update @usebruno/converters and retry; if it persists, file an issue with the failing source spec."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"try {\n  await collectionSchema.validate(collection);\n} catch (schemaErr) {\n  console.error('Schema violation:', schemaErr);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await validateSchema(collection);\n} catch (err) {\n  // 'The Collection file is corrupted' is opaque; re-run collectionSchema.validate\n  // separately to obtain the field-level Yup error.\n  throw err;\n}","preventionTips":["Run collectionSchema.validate directly to read the field-level error Yup emits.","Keep @usebruno/converters updated so converter output matches the schema.","Validate converted collections in CI before user-facing import."],"tags":["import","collection","schema","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}