{"record":{"id":"3d9ee67edf717505","repo":"usebruno/bruno","slug":"invalid-url-format-url","errorCode":null,"errorMessage":"Invalid URL format: ${url}","messagePattern":"Invalid URL format: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-converters/src/postman/bruno-to-postman.js","lineNumber":88,"sourceCode":"  };\n\n  const postmanUrl = { raw: url };\n\n  /**\n   * Splits a URL into its protocol, host and path.\n   *\n   * @param {string} url - The URL to be split.\n   * @returns {Object} An object containing the protocol and the raw host/path string.\n   */\n  const splitUrl = (url) => {\n    const urlParts = url.split(urlRegexPatterns.protocolAndRestSeparator);\n    if (urlParts.length === 1) {\n      return { protocol: '', rawHostAndPath: urlParts[0] };\n    } else if (urlParts.length === 2) {\n      const [hostAndPath, _] = urlParts[1].split(urlRegexPatterns.queryStringSeparator);\n      return { protocol: urlParts[0], rawHostAndPath: hostAndPath };\n    } else {\n      throw new Error(`Invalid URL format: ${url}`);\n    }\n  };\n\n  /**\n   * Splits the host and path from a raw host/path string.\n   *\n   * @param {string} rawHostAndPath - The raw host and path string to be split.\n   * @returns {Object} An object containing the host and path.\n   */\n  const splitHostAndPath = (rawHostAndPath) => {\n    const [host, path = ''] = rawHostAndPath.split(urlRegexPatterns.hostAndPathSeparator);\n    return { host, path };\n  };\n\n  try {\n    const { protocol, rawHostAndPath } = splitUrl(url);\n    postmanUrl.protocol = protocol;\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-converters/src/postman/bruno-to-postman.js#L70-L106","documentation":"Thrown by splitUrl inside transformUrl when splitting the URL on the /:\\/\\// regex produces more than two segments — i.e. the URL contains multiple '://' occurrences. A well-formed URL splits into at most two parts (protocol + rest), so reaching the else branch means the input URL is structurally malformed for the purpose of Postman export.","triggerScenarios":"Exporting a Bruno request to Postman where the request URL contains multiple '://' sequences. Examples: 'http://https://api.example.com', 'ws://wss://host', or a URL with a '://' literal inside a path/query that the simple regex cannot disambiguate.","commonSituations":"A request URL copy-pasted with a duplicated scheme; WebSocket URLs that were concatenated; templated URLs where a {{protocol}} variable resolved to include '://'; URLs containing '://' inside a query parameter.","solutions":["Sanitize the request URL before export: strip duplicate protocol prefixes (`url.replace(/^(\\w+):\\/\\/.*/, ...)`).","Move the literal '://' out of the path/query (URL-encode it as %3A%2F%2F).","If the URL legitimately needs multiple schemes, pre-process it into protocol/host/path manually before passing to the exporter."],"exampleFix":"// before\nconst url = 'http://https://api.example.com/users';\ntransformUrl(url, params); // throws Invalid URL format\n\n// after — normalize to single scheme\nconst safeUrl = url.replace(/^(\\w+):\\/\\//, '').replace(/^(https?:)?\\/\\//, '$1//');\ntransformUrl(safeUrl || 'http://' + url, params);","handlingStrategy":"validation","validationCode":"const hasSingleScheme = (u) => (typeof u === 'string' ? (u.match(/:\\/\\//g) || []).length <= 1 : false);\n// before export:\nif (!hasSingleScheme(req.url)) req.url = req.url.replace(/^(\\w+):\\/\\/.*/, '$1://').replace(/:\\/\\/+/g, '://');","typeGuard":"const isValidSingleSchemeUrl = (u) => typeof u === 'string' && (u.match(/:\\/\\//g) || []).length <= 1;","tryCatchPattern":"try {\n  return transformUrl(url, params);\n} catch (e) {\n  if (e.message.startsWith('Invalid URL format')) {\n    return transformUrl('', params); // fall back to empty URL\n  }\n  throw e;\n}","preventionTips":["Normalize request URLs at collection load time to a single scheme.","URL-encode any literal '://' that legitimately appears in path or query.","Add a pre-export lint pass over item.request.url."],"tags":["url-parsing","postman-export","bruno-converters","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}