{"record":{"id":"ff1307e9efaf6d98","repo":"usebruno/bruno","slug":"wsdl-content-must-be-a-string-ff1307","errorCode":null,"errorMessage":"WSDL content must be a string","messagePattern":"WSDL content must be a string","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-converters/src/wsdl/wsdl-to-bruno.js","lineNumber":1113,"sourceCode":"\n    // Add all operations directly to the service folder\n    serviceFolder.items = allOperations;\n\n    if (serviceFolder.items.length > 0) {\n      collection.items.push(serviceFolder);\n    }\n  }\n\n  return collection;\n};\n\n/**\n * Convert WSDL content to Bruno collection\n */\nexport const wsdlToBruno = async (wsdlContent) => {\n  try {\n    if (typeof wsdlContent !== 'string') {\n      throw new Error('WSDL content must be a string');\n    }\n\n    // Parse WSDL using enhanced parser\n    const parser = new WSDLParser();\n    const wsdlData = await parser.parse(wsdlContent);\n\n    const collection = parseWSDLCollection(wsdlData);\n    const transformedCollection = transformItemsInCollection(collection);\n    const hydratedCollection = hydrateSeqInCollection(transformedCollection);\n    const validatedCollection = validateSchema(hydratedCollection);\n\n    return validatedCollection;\n  } catch (err) {\n    console.error(err);\n    throw new Error('Import WSDL collection failed: ' + err.message);\n  }\n};\n","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-converters/src/wsdl/wsdl-to-bruno.js#L1095-L1131","documentation":"Thrown by wsdlToBruno when the wsdlContent argument is not of type string. The parser pipeline (parseXML, WSDLParser) operates on a string, so passing a Buffer, an object, null, or undefined is rejected up front. This is a pure input-type guard at the public API boundary.","triggerScenarios":"Calling wsdlToBruno(buffer) where buffer is a Node Buffer from fs.readFile (without encoding); passing the parsed object from xml2js directly; passing null/undefined; passing a number.","commonSituations":"Reading a .wsdl file with fs.readFile (no encoding) and passing the Buffer; forgetting to await fs.promises.readFile(path, 'utf8'); double-parsing the XML before calling.","solutions":["Read the file with an encoding: `fs.readFileSync(path, 'utf8')` or `fs.promises.readFile(path, 'utf8')`.","If you have a Buffer, convert: `wsdlToBruno(buffer.toString('utf8'))`.","Ensure you pass the raw XML text, not a pre-parsed object."],"exampleFix":"// before\nconst buf = fs.readFileSync('service.wsdl');\nawait wsdlToBruno(buf); // Buffer, not string\n\n// after\nconst text = fs.readFileSync('service.wsdl', 'utf8');\nawait wsdlToBruno(text);","handlingStrategy":"type-guard","validationCode":"if (typeof wsdlContent !== 'string') {\n  wsdlContent = Buffer.isBuffer(wsdlContent) ? wsdlContent.toString('utf8') : String(wsdlContent);\n}","typeGuard":"const isStringContent = (c) => typeof c === 'string';","tryCatchPattern":null,"preventionTips":["Always read WSDL files with an 'utf8' encoding argument.","Convert Buffers explicitly: buf.toString('utf8').","Do not pre-parse the XML before calling wsdlToBruno."],"tags":["wsdl","type-guard","input-validation","bruno-converters","buffer"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}