usebruno/bruno · error · Error

invalid request url

Error message

invalid request url

What it means

Error "invalid request url" thrown in usebruno/bruno.

Source

Thrown at packages/bruno-common/src/generate-code/har/index.ts:649

  // each one for the path-param value (raw or encoded per the flag).
  const encodeFlag = working.settings?.encodeUrl === true;
  const { url: urlWithPlaceholders, restore: restorePathParams } = hashPathParamPositions(urlForPipeline, working.pathParams);

  // Step 4 — Apply `encodeUrl()` to the URL with placeholders. Placeholders
  // are alphanumeric+dash, so `encodeURIComponent` (used per path segment
  // inside `encodeUrl`) leaves them untouched. The rest of the path and
  // query are encoded per the existing content-blind contract (PR #5507).
  const encodedUrlWithPlaceholders = encodeUrl(urlWithPlaceholders);

  // Step 5 — Restore placeholders. `rawUrl` always uses raw values (for the
  // toggle-OFF display swap upstream). `encodedUrl` uses single-encoded
  // values when toggle is ON, raw when OFF.
  const rawUrl = restorePathParams(urlWithPlaceholders, { encode: false });
  const encodedUrl = restorePathParams(encodedUrlWithPlaceholders, { encode: encodeFlag });

  // Sanity gate. Stays here so HAR consumers see exactly what we'd send.
  if (!looksLikeUrl(encodedUrl)) {
    throw new Error('invalid request url');
  }

  // Step 5 — Auth → headers. Append to request headers. Request-signing auth (EdgeGrid) must
  // sign the same `encodedUrl` the snippet transmits, or the signature won't cover the sent bytes.
  const authHeaders = await authToHeaders(working.auth, variables, input.oauth2Credentials, input.collectionUid, {
    method: working.method || 'GET',
    url: encodedUrl,
    headers: working.headers,
    bodyText: buildPostData(working.body)?.text
  });
  const allHeaders = mergeAndDedupeHeaders(working.headers, authHeaders);

  // Step 6 — Finalize headers (filter enabled, lowercase, default content-type).
  const harHeaders = finalizeHeaders(working, allHeaders);

  // Step 7 — Query string array. HAR's queryString is the single source of
  // truth for what HTTPSnippet renders into the URL slot. The URL itself
  // (next step) has its query stripped to avoid the legacy-polyfill merge bug.

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Ensure the request URL is a valid absolute URL including protocol (http/https).
  2. Fix variable substitutions that produced an empty or malformed URL.

When it happens

Trigger: Thrown at packages/bruno-common/src/generate-code/har/index.ts:649 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/7c27ed34763af96b. Report an issue: GitHub.