{"record":{"id":"10d66784f67cca04","repo":"we-promise/sure","slug":"not-found-10d667","errorCode":"not_found","errorMessage":"Resource not found","messagePattern":"Resource not found","errorType":"exception","errorClass":"Provider::Redbark::Error","httpStatus":404,"severity":"error","filePath":"app/models/provider/redbark.rb","lineNumber":244,"sourceCode":"        \"Accept\" => \"application/json\"\n      }\n    end\n\n    # Redbark error envelope: { error: { message, code, details } }\n    # Error messages carry the parsed provider message only, never the raw\n    # response body - callers log and re-log these strings.\n    def handle_response(response)\n      case response.code\n      when 200, 201\n        JSON.parse(response.body, symbolize_names: true)\n      when 400\n        raise Error.new(\"Bad request: #{error_message_from(response)}\", :bad_request)\n      when 401\n        raise AuthenticationError.new(\"Invalid API key\", :unauthorized)\n      when 403\n        raise AuthenticationError.new(\"Access forbidden - your Redbark plan may not include API access\", :access_forbidden)\n      when 404\n        raise Error.new(\"Resource not found\", :not_found)\n      when 410\n        raise Error.new(\"Endpoint requires an accountId: #{error_message_from(response)}\", :bad_request)\n      when 429\n        raise RateLimitError.new(\"Rate limit exceeded\", :rate_limited)\n      when 500..599\n        raise ServerError.new(\"Redbark server error (#{response.code})\", :server_error)\n      else\n        raise Error.new(\"Unexpected response #{response.code}: #{error_message_from(response)}\", :unknown)\n      end\n    end\n\n    def error_message_from(response)\n      parsed = JSON.parse(response.body)\n      parsed.dig(\"error\", \"message\") || \"no error message provided\"\n    rescue JSON::ParserError\n      \"unparseable error response\"\n    end\nend","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/redbark.rb#L226-L262","documentation":"Raised by Provider::Redbark's handle_response on HTTP 404 with error_type :not_found. The requested resource (endpoint path or referenced entity) does not exist on Redbark's side.","triggerScenarios":"get_transactions or get_balances called with an accountId/connectionId that was deleted or disconnected at Redbark; requesting an endpoint removed from the API version at BASE_URL (https://api.redbark.com/v1).","commonSituations":"User disconnects a bank at Redbark while your sync still holds its cached ids; stale account ids persisted from an old connection; Redbark API version bump removing an endpoint.","solutions":["Refresh the id list via list_accounts/list_connections and drop ids that no longer exist","Verify the id values being passed match the response shapes ({ id } for accounts, { id } for connections)","If every call 404s including /accounts, check the Redbark changelog for a versioned endpoint change","Treat per-entity 404s during sync as 'disconnected upstream' and deactivate that entity locally"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def redbark_account_active?(redbark, connection_id, account_id)\n  redbark.list_accounts.any? { |a| a[:id] == account_id && a[:connectionId] == connection_id }\nend","typeGuard":"def redbark_not_found?(error)\n  error.is_a?(Provider::Redbark::Error) && error.error_type == :not_found\nend","tryCatchPattern":"begin\n  redbark.get_balances(account_ids: [aid])\nrescue Provider::Redbark::Error => e\n  raise unless e.error_type == :not_found\n  deactivate_account_locally(aid) # disconnected upstream at Redbark\nend","preventionTips":["Refresh account/connection ids from list_accounts before syncing rather than trusting cached ids","Treat per-entity 404 as a deletion signal, not a transient error","Clean up local references when users disconnect institutions upstream"],"tags":["redbark","http-404","not-found","stale-ids"],"backgroundTag":"http-404-not-found","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}