responsively-org/responsively-app · warning
Not a valid URL
Error message
Not a valid URL
What it means
This console.warn fires in the catch block of isValidCliArgURL when new URL(arg) itself throws a SyntaxError, meaning the CLI argument is not a parseable URL at all (not merely an unsupported protocol). The raw argument and the underlying error are logged, the cached isCliArgResult is set to false, and the function returns false so the caller treats the argument as invalid.
Source
Thrown at desktop-app/src/main/util.ts:38
export function isValidCliArgURL(arg?: string): boolean {
if (isCliArgResult !== undefined) {
return isCliArgResult;
}
if (arg == null || arg === '') {
isCliArgResult = false;
return false;
}
try {
const url = new URL(arg);
if (url.protocol === 'http:' || url.protocol === 'https:' || url.protocol === 'file:') {
isCliArgResult = true;
return true;
}
// eslint-disable-next-line no-console
console.warn('Protocol not supported', url.protocol);
} catch (e) {
// eslint-disable-next-line no-console
console.warn('Not a valid URL', arg, e);
}
isCliArgResult = false;
return false;
}
export const getPackageJson = () => {
let appPath;
if (process.env.NODE_ENV === 'production') appPath = app.getAppPath();
else appPath = process.cwd();
const pkgPath = path.join(appPath, 'package.json');
if (fs.existsSync(pkgPath)) {
const pkgContent = fs.readFileSync(pkgPath, 'utf-8');
return JSON.parse(pkgContent);
}
console.error(`cant find package.json in: '${appPath}'`);
return {};
};View on GitHub (pinned to e5623c5a70)
Solutions
- Prefix the argument with a scheme before passing it, e.g. https://example.com instead of example.com
- On the code side, auto-prepend https:// when the arg looks like a bare domain before new URL()
- Quote arguments in shell scripts so spaces and special characters survive
- Convert Windows file paths to file:/// URLs (forward slashes) before passing
Example fix
// before app --open example.com/page // after app --open https://example.com/page // code-side normalization if (!/^[a-z][a-z0-9+.-]*:/i.test(arg)) arg = 'https://' + arg;
Defensive patterns
Strategy: validation
Validate before calling
function looksLikeBareDomain(s: string): boolean {
return /^[\w-]+(\.[\w-]+)+([/?#].*)?$/.test(s);
}
const normalized = /^[a-z][a-z0-9+.-]*:/i.test(arg) ? arg : 'https://' + arg;
let ok = false;
try { new URL(normalized); ok = true; } catch { ok = false; } Type guard
function isParseableUrl(s: string): s is string {
try { new URL(s); return true; } catch { return false; }
} Prevention
- Require a scheme in user-facing docs and flag bare domains in input validation
- Auto-prepend https:// for arguments matching a domain pattern before new URL()
- Quote CLI arguments in shell scripts to prevent mangling
- Reject empty and whitespace-only args before parsing
When it happens
Trigger: Passing a bare string like 'example.com' (no scheme), an empty string, a string with spaces/invalid characters, or malformed input like 'http://' or 'ht!tp://x' as a CLI argument.
Common situations: Users forgetting the https:// prefix, shell scripts passing unquoted values that get mangled, empty args from environment expansion, Windows paths like C:\file.txt (backslashes are invalid in URLs).
Related errors
AI-assisted analysis of responsively-org/responsively-app@e5623c5a70 (2026-08-31).
Data as JSON: /api/errors/ceb3351963711e8c.
Report an issue: GitHub.