{"record":{"id":"d903df91886e1a12","repo":"usebruno/bruno","slug":"invalid-environment-json-expected-a-single-enviro","errorCode":null,"errorMessage":"Invalid environment JSON: expected a single environment object with a \"variables\" array","messagePattern":"Invalid environment JSON: expected a single environment object with a \"variables\" array","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-cli/src/utils/environment.js","lineNumber":7,"sourceCode":"/**\n * Parse a Bruno JSON environment object and normalize variables\n * Accepts only single environment object: { name?, uid?, variables: [...] }\n */\nconst parseEnvironmentJson = (parsed = {}) => {\n  if (!parsed || !Array.isArray(parsed.variables)) {\n    throw new Error('Invalid environment JSON: expected a single environment object with a \"variables\" array');\n  }\n\n  const normalized = {\n    name: parsed.name,\n    variables: (parsed.variables || []).filter(Boolean).map((variable) => ({\n      name: variable.name,\n      value: variable.value,\n      type: variable.type || 'text',\n      enabled: variable.enabled !== false,\n      secret: variable.secret || false\n    }))\n  };\n\n  return normalized;\n};\n\nmodule.exports = {\n  parseEnvironmentJson","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-cli/src/utils/environment.js#L1-L25","documentation":"Error \"Invalid environment JSON: expected a single environment object with a \"variables\" array\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-cli/src/utils/environment.js:7 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide an environment JSON file with a single object containing a \"variables\" array.","Check the file is not an array of environments or an unrelated JSON document."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}