usebruno/bruno · warning
INVALID_REQUEST
INVALID_REQUEST
Error message
Missing or invalid url
What it means
Returned (not thrown) by proxySwaggerFetch when req.url is falsy or not a string. This is an input-validation guard at the IPC boundary: it short-circuits before any network/proxy work and returns a structured error object { error: true, code: 'INVALID_REQUEST', message } that the IPC caller is expected to inspect. Because it is a return value, try/catch will not catch it — the caller must check the .error / .code fields.
Source
Thrown at packages/bruno-electron/src/ipc/swagger-fetch.js:10
const { getCertsAndProxyConfig } = require('./network/cert-utils');
const { makeAxiosInstance } = require('./network/axios-instance');
const proxySwaggerFetch = async (req = {}) => {
const { url, method, headers, body } = req || {};
if (!url || typeof url !== 'string') {
return {
error: true,
code: 'INVALID_REQUEST',
message: 'Missing or invalid url'
};
}
try {
const { proxyMode, proxyConfig, httpsAgentRequestFields, interpolationOptions }
= await getCertsAndProxyConfig({
collectionUid: null,
collection: { promptVariables: {} },
request: { url },
envVars: {},
runtimeVariables: {},
processEnvVars: {},
collectionPath: '',
globalEnvironmentVariables: {}
});
const axiosInstance = makeAxiosInstance({View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Check the returned object's .error flag (and .code === 'INVALID_REQUEST') before consuming status/headers/body.
- Require and validate the URL field in the renderer form before invoking the IPC handler.
- Coerce/normalize url to a string and trim it client-side before sending.
Example fix
// before
const res = await proxySwaggerFetch({ url: maybeUrl });
if (res.status) handle(res);
// after
const res = await proxySwaggerFetch({ url: maybeUrl });
if (res?.error) {
showUserError(res.code, res.message); // 'INVALID_REQUEST', 'Missing or invalid url'
return;
}
handle(res); Defensive patterns
Strategy: validation
Validate before calling
function hasValidUrl(req) {
return req != null && typeof req.url === 'string' && req.url.trim().length > 0;
}
if (!hasValidUrl(req)) {
return { error: true, code: 'INVALID_REQUEST', message: 'Missing or invalid url' };
}
return proxySwaggerFetch(req); Type guard
function isSwaggerReq(v) {
return v != null && typeof v === 'object' && typeof v.url === 'string' && v.url.trim().length > 0;
}
// or, after the call (it returns errors, does not throw):
function isSwaggerErrorResult(r) { return r != null && r.error === true && typeof r.code === 'string'; } Prevention
- proxySwaggerFetch returns errors instead of throwing — always check result.error and result.code before reading status/body.
- Validate and trim the URL field in the renderer form and disable Submit until it is a non-empty string.
- Centralize IPC payload validation so missing required fields never reach the handler.
- Normalize url to a trimmed string before forwarding from the UI.
When it happens
Trigger: The Electron IPC handler for swagger fetch is invoked with a req object lacking url, with url: null/undefined, or with url set to a non-string (number, object). The renderer submitted the form before the URL field was filled, or a programmatic caller forgot to set the field.
Common situations: User clicks 'Import from URL' with an empty URL field; a scripted caller posts an incomplete payload; a refactor stopped forwarding the url field from the renderer; URL stored as null in collection state and reused without normalization.
Related errors
- Could not reach the mock server
- Invalid file format. Please select a valid OpenAPI spec in Y
- Mock server id is required.
- Workspace path is required.
- ${request.filename} is not a valid filename
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/960370bcbf02a22c.
Report an issue: GitHub.