{"record":{"id":"b7623e82cc65e7d7","repo":"usebruno/bruno","slug":"invalid-strategy","errorCode":null,"errorMessage":"Invalid strategy","messagePattern":"Invalid strategy","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/utils/git.js","lineNumber":609,"sourceCode":"          git.push(remote, remoteBranch, (err, res) => {\n            if (err) {\n              reject(err);\n            } else {\n              resolve(res);\n            }\n          });\n        }\n      });\n    } catch (error) {\n      reject(error);\n    }\n  });\n};\n\nconst pullGitChanges = async (win, data) => {\n  const { gitRootPath, processUid, remote, remoteBranch, strategy } = data;\n  if (strategy !== '--no-rebase' && strategy !== '--ff-only') {\n    throw new Error('Invalid strategy');\n  }\n  return new Promise((resolve, reject) => {\n    const git = getSimpleGitInstanceForPath(gitRootPath);\n    git.outputHandler(handleGitOutput({ win, processUid, sendStdout: true })).pull(remote, remoteBranch, [strategy], (err, res) => {\n      if (err) {\n        reject(err);\n      } else {\n        resolve(res);\n      }\n    });\n  });\n};\n\nasync function getChangedFilesInCollectionGit(_gitRootPath, _collectionPath) {\n  return new Promise((resolve, reject) => {\n    const git = getSimpleGitInstanceForPath(_gitRootPath);\n    git.status(['--porcelain', _gitRootPath], async (err, status) => {\n      if (err) {","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/utils/git.js#L591-L627","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst { strategy } = data;\nif (strategy !== '--no-rebase' && strategy !== '--ff-only') {\n  throw new Error('Invalid strategy');\n}\n\n// after: map + default at the boundary\nconst STRATEGY_MAP = { rebase: '--no-rebase', fastForward: '--ff-only' };\nconst strategy = STRATEGY_MAP[data.strategy] ?? '--ff-only';","handlingStrategy":"validation","validationCode":"const STRATEGY_MAP = { rebase: '--no-rebase', fastForward: '--ff-only' };\nconst strategy = STRATEGY_MAP[data.strategy] ?? '--ff-only';\nawait pullGitChanges(win, { ...data, strategy });","typeGuard":"function isSupportedPullStrategy(strategy) {\n  return strategy === '--no-rebase' || strategy === '--ff-only';\n}","tryCatchPattern":"try {\n  await pullGitChanges(win, data);\n} catch (err) {\n  if (err.message === 'Invalid strategy') {\n    return pullGitChanges(win, { ...data, strategy: '--ff-only' });\n  }\n  throw err;\n}","preventionTips":["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."],"tags":["git","validation","ipc-wiring"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}