{"record":{"id":"bb13afdee8e6e4d0","repo":"langgenius/dify","slug":"invalid-partner-information","errorCode":null,"errorMessage":"Invalid partner information","messagePattern":"Invalid partner information","errorType":"http","errorClass":"BadRequest","httpStatus":400,"severity":"error","filePath":"api/controllers/console/billing/billing.py","lineNumber":99,"sourceCode":"    @console_ns.doc(params={\"partner_key\": \"Partner key\"})\n    @console_ns.expect(console_ns.models[PartnerTenantsPayload.__name__])\n    @console_ns.response(200, \"Tenants synced to partner successfully\", console_ns.models[BillingResponse.__name__])\n    @console_ns.response(400, \"Invalid partner information\")\n    @setup_required\n    @login_required\n    @account_initialization_required\n    @only_edition_cloud\n    @with_current_user\n    @model_validate(PartnerTenantsPayload)\n    def put(self, req_data: PartnerTenantsPayload, current_user: Account, partner_key: str):\n        try:\n            click_id = req_data.click_id\n            decoded_partner_key = base64.b64decode(partner_key).decode(\"utf-8\")\n        except Exception:\n            raise BadRequest(\"Invalid partner_key\")\n\n        if not click_id or not decoded_partner_key or not current_user.id:\n            raise BadRequest(\"Invalid partner information\")\n\n        return BillingService.sync_partner_tenants_bindings(current_user.id, decoded_partner_key, click_id)\n","sourceCodeStart":81,"sourceCodeEnd":102,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/billing/billing.py#L81-L102","documentation":"Flask BadRequest (HTTP 400) raised at billing.py:99 after successful base64 decode, when any of click_id (from PartnerTenantsPayload), decoded_partner_key, or current_user.id is falsy. It is a post-decode sanity check distinct from 'Invalid partner_key': decoding worked, but one of the required values is empty/missing.","triggerScenarios":"PUT /console/api/billing/partner/tenants/<partner_key> with a validly-decoded partner_key but a payload that omits click_id, an empty decoded key, or an authenticated session where current_user.id is unset. Any single falsy field triggers it.","commonSituations":"Frontend form submits without a click_id (e.g. UTM/tracking param absent); the decoded partner key is an empty string; or a session/auth middleware bug leaves current_user without an id. Cloud-only endpoint.","solutions":["Ensure the request body includes a non-empty click_id in the PartnerTenantsPayload.","Confirm the partner_key decodes to a non-empty string (not just valid base64 of empty bytes).","Verify the authenticated session actually populates current_user.id — re-login if the session is partial.","Add client-side validation to require click_id before enabling submit."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Require click_id and a non-empty decoded key before submitting.\nif (!clickId) throw new Error('click_id is required');\nif (!decodedPartnerKey) throw new Error('decoded partner_key is empty');\nif (!currentUserId) throw new Error('session missing user id');\nawait putPartnerTenants(partnerKey, clickId);","typeGuard":"function hasAllPartnerFields(p: {click_id?: string; decoded?: string; uid?: string}): boolean {\n  return Boolean(p.click_id && p.decoded && p.uid);\n}","tryCatchPattern":"try {\n  await putPartnerTenants(partnerKey, clickId);\n} catch (e) {\n  if (/Invalid partner information/i.test(e.message)) { ensureClickIdAndSession(); } else throw e;\n}","preventionTips":["Validate click_id presence client-side before enabling submit.","Ensure the session is fully authenticated (current_user.id present).","Do not send empty partner keys; reject empty decoded values locally."],"tags":["billing","partner","request-validation","cloud-edition"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}