{"record":{"id":"d166eea71427aed8","repo":"usebruno/bruno","slug":"sourceurl-is-required-to-update-openapi-sync-confi","errorCode":null,"errorMessage":"sourceUrl is required to update openapi sync config","messagePattern":"sourceUrl is required to update openapi sync config","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/openapi-sync.js","lineNumber":1697,"sourceCode":"  });\n\n  // Update OpenAPI sync configuration (e.g., source URL)\n  ipcMain.handle('renderer:update-openapi-sync-config', async (event, { collectionPath, config }) => {\n    try {\n      const { format, brunoConfig, collectionRoot } = loadBrunoConfig(collectionPath);\n\n      // Merge new config into existing entry (allowlist keys only)\n      const allowedKeys = ['sourceUrl', 'groupBy', 'lastSyncDate', 'specHash', 'autoCheck', 'autoCheckInterval'];\n      const sanitizedConfig = {};\n      for (const key of allowedKeys) {\n        if (key in config) {\n          sanitizedConfig[key] = config[key];\n        }\n      }\n\n      // sourceUrl is required — it identifies which entry to create/update\n      if (!sanitizedConfig.sourceUrl) {\n        throw new Error('sourceUrl is required to update openapi sync config');\n      }\n\n      // Validate sourceUrl — reject protocol-based non-http(s) URLs (e.g. ftp://, file://)\n      if (sanitizedConfig.sourceUrl.includes('://') && !isValidHttpUrl(sanitizedConfig.sourceUrl)) {\n        throw new Error('Invalid URL: only http and https URLs are allowed');\n      }\n\n      // Resolve to absolute for consistent internal handling (saveBrunoConfig converts back to relative)\n      sanitizedConfig.sourceUrl = resolveSourceUrl(collectionPath, sanitizedConfig.sourceUrl);\n\n      // Update or create the single openapi entry\n      const existingEntry = brunoConfig.openapi?.[0];\n      if (existingEntry) {\n        brunoConfig.openapi = [{ ...existingEntry, ...sanitizedConfig }];\n      } else {\n        if (!('autoCheck' in sanitizedConfig)) sanitizedConfig.autoCheck = true;\n        if (!('autoCheckInterval' in sanitizedConfig)) sanitizedConfig.autoCheckInterval = 5;\n        brunoConfig.openapi = [sanitizedConfig];","sourceCodeStart":1679,"sourceCodeEnd":1715,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/openapi-sync.js#L1679-L1715","documentation":"Error \"sourceUrl is required to update openapi sync config\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/ipc/openapi-sync.js:1697 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the sourceUrl of the remote OpenAPI spec when updating the sync config."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}