{"record":{"id":"83413e56639843ab","repo":"usebruno/bruno","slug":"a-non-empty-git-remote-url-is-required","errorCode":null,"errorMessage":"A non-empty Git remote URL is required","messagePattern":"A non-empty Git remote URL is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/utils/workspace-config.js","lineNumber":445,"sourceCode":"\n  const hasManagedEntries = filteredManagedLines.some((line) => line.trim() !== '');\n  const filtered = hasManagedEntries\n    ? [\n        ...lines.slice(0, managedBlock.start + 1),\n        ...filteredManagedLines,\n        ...lines.slice(managedBlock.end)\n      ]\n    : [\n        ...lines.slice(0, managedBlock.start),\n        ...lines.slice(managedBlock.end + 1)\n      ];\n\n  await writeFile(gitignorePath, filtered.join('\\n'));\n};\n\nconst setCollectionGitRemote = async (workspacePath, collectionPath, remoteUrl) => {\n  if (typeof remoteUrl !== 'string' || remoteUrl.trim() === '') {\n    throw new Error('A non-empty Git remote URL is required');\n  }\n  const trimmedUrl = remoteUrl.trim();\n\n  return withLock(getWorkspaceLockKey(workspacePath), async () => {\n    const config = readWorkspaceConfig(workspacePath);\n    const target = path.normalize(collectionPath);\n    let matched = false;\n\n    config.collections = (config.collections || []).map((c) => {\n      if (getNormalizedAbsoluteCollectionPath(workspacePath, c) !== target) return c;\n      matched = true;\n      return { ...c, remote: trimmedUrl };\n    });\n\n    if (!matched) {\n      throw new Error('Collection not found in workspace');\n    }\n","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/utils/workspace-config.js#L427-L463","documentation":"`setCollectionGitRemote` validates that `remoteUrl` is a non-empty string before touching the workspace. It rejects null, non-strings, and whitespace-only values outright.","triggerScenarios":"Calling `setCollectionGitRemote(workspacePath, collectionPath, remoteUrl)` with `remoteUrl` undefined, not a string, or empty/whitespace after `trim()`.","commonSituations":"A 'set remote' form submitted blank; a caller passed the whole git config object instead of the URL field; clipboard paste of an empty cell; a refactor that swapped argument order.","solutions":["Pass a non-empty git URL string (e.g. `https://github.com/org/repo.git`).","Trim and validate the URL in the form/controller before calling.","If the intent is to clear the remote, call `clearCollectionGitRemote` instead."],"exampleFix":"// before\nawait setCollectionGitRemote(wsPath, colPath, '');\n\n// after\nawait setCollectionGitRemote(wsPath, colPath, 'https://github.com/org/repo.git');","handlingStrategy":"validation","validationCode":"function assertRemoteUrl(url) {\n  if (typeof url !== 'string' || url.trim() === '') {\n    throw new Error('A non-empty Git remote URL is required');\n  }\n  return url.trim();\n}","typeGuard":"function isNonEmptyRemoteUrl(url: unknown): url is string {\n  return typeof url === 'string' && url.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Validate the URL field before enabling the action.","To remove a remote, call clearCollectionGitRemote instead of passing empty."],"tags":["workspace","collection","git","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}