langgenius/dify · error · BadRequest
Invalid partner information
Error message
Invalid partner information
What it means
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.
Source
Thrown at api/controllers/console/billing/billing.py:99
@console_ns.doc(params={"partner_key": "Partner key"})
@console_ns.expect(console_ns.models[PartnerTenantsPayload.__name__])
@console_ns.response(200, "Tenants synced to partner successfully", console_ns.models[BillingResponse.__name__])
@console_ns.response(400, "Invalid partner information")
@setup_required
@login_required
@account_initialization_required
@only_edition_cloud
@with_current_user
@model_validate(PartnerTenantsPayload)
def put(self, req_data: PartnerTenantsPayload, current_user: Account, partner_key: str):
try:
click_id = req_data.click_id
decoded_partner_key = base64.b64decode(partner_key).decode("utf-8")
except Exception:
raise BadRequest("Invalid partner_key")
if not click_id or not decoded_partner_key or not current_user.id:
raise BadRequest("Invalid partner information")
return BillingService.sync_partner_tenants_bindings(current_user.id, decoded_partner_key, click_id)
View on GitHub (pinned to ef8544b173)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Require click_id and a non-empty decoded key before submitting.
if (!clickId) throw new Error('click_id is required');
if (!decodedPartnerKey) throw new Error('decoded partner_key is empty');
if (!currentUserId) throw new Error('session missing user id');
await putPartnerTenants(partnerKey, clickId); Type guard
function hasAllPartnerFields(p: {click_id?: string; decoded?: string; uid?: string}): boolean {
return Boolean(p.click_id && p.decoded && p.uid);
} Try / catch
try {
await putPartnerTenants(partnerKey, clickId);
} catch (e) {
if (/Invalid partner information/i.test(e.message)) { ensureClickIdAndSession(); } else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid partner_key
- This email account has been deleted within the past 30 days
- provider_quota_exceeded
- model_currently_not_support
- account_in_freeze
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/bb13afdee8e6e4d0.
Report an issue: GitHub.