usebruno/bruno · error · Error
Invalid strategy
Error message
Invalid strategy
What it means
Thrown by pullGitChanges when the strategy field of the data payload is not one of the two supported values: '--no-rebase' or '--ff-only'. These map to git pull flags; anything else would be passed unsanitized to git, so the function rejects it up front.
Source
Thrown at packages/bruno-electron/src/utils/git.js:609
git.push(remote, remoteBranch, (err, res) => {
if (err) {
reject(err);
} else {
resolve(res);
}
});
}
});
} catch (error) {
reject(error);
}
});
};
const pullGitChanges = async (win, data) => {
const { gitRootPath, processUid, remote, remoteBranch, strategy } = data;
if (strategy !== '--no-rebase' && strategy !== '--ff-only') {
throw new Error('Invalid strategy');
}
return new Promise((resolve, reject) => {
const git = getSimpleGitInstanceForPath(gitRootPath);
git.outputHandler(handleGitOutput({ win, processUid, sendStdout: true })).pull(remote, remoteBranch, [strategy], (err, res) => {
if (err) {
reject(err);
} else {
resolve(res);
}
});
});
};
async function getChangedFilesInCollectionGit(_gitRootPath, _collectionPath) {
return new Promise((resolve, reject) => {
const git = getSimpleGitInstanceForPath(_gitRootPath);
git.status(['--porcelain', _gitRootPath], async (err, status) => {
if (err) {View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Map the UI's strategy option to '--no-rebase' or '--ff-only' at the IPC boundary before calling pullGitChanges.
- Default to '--ff-only' (or '--no-rebase') when strategy is missing.
- Add the new strategy to the whitelist here when the UI legitimately introduces a new pull mode.
Example fix
// before
const { strategy } = data;
if (strategy !== '--no-rebase' && strategy !== '--ff-only') {
throw new Error('Invalid strategy');
}
// after: map + default at the boundary
const STRATEGY_MAP = { rebase: '--no-rebase', fastForward: '--ff-only' };
const strategy = STRATEGY_MAP[data.strategy] ?? '--ff-only'; Defensive patterns
Strategy: validation
Validate before calling
const STRATEGY_MAP = { rebase: '--no-rebase', fastForward: '--ff-only' };
const strategy = STRATEGY_MAP[data.strategy] ?? '--ff-only';
await pullGitChanges(win, { ...data, strategy }); Type guard
function isSupportedPullStrategy(strategy) {
return strategy === '--no-rebase' || strategy === '--ff-only';
} Try / catch
try {
await pullGitChanges(win, data);
} catch (err) {
if (err.message === 'Invalid strategy') {
return pullGitChanges(win, { ...data, strategy: '--ff-only' });
}
throw err;
} Prevention
- Map UI strategy options to the two git flags at the IPC boundary.
- Default to '--ff-only' when strategy is missing.
- When adding a new pull mode, extend the whitelist in the same change.
When it happens
Trigger: Calling pullGitChanges with data.strategy undefined, empty, or a value like '--merge', 'rebase', 'ff', or '' — typically because the renderer passed a UI enum value that was not mapped to the git flag.
Common situations: UI dropdown changed its option codes without updating the IPC mapping; null strategy forwarded from a default payload; new merge mode added to the UI but not allow-listed here.
Related errors
- Invalid Git URL
- Remote not configured
- A non-empty Git remote URL is required
- Collection not found in workspace
- Workspace path not found
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/b7623e82cc65e7d7.
Report an issue: GitHub.