bitwarden/server · error · NotFoundException
Organization not found.
Error message
Organization not found.
What it means
Thrown (HTTP 404) by GET /licenses/organization/{id} when _organizationRepository.GetByIdAsync(new Guid(id)) returns null — i.e. no organization exists for that id. A malformed id that cannot parse to a Guid would throw earlier at new Guid(id).
Source
Thrown at src/Api/Billing/Controllers/LicensesController.cs:74
{
await Task.Delay(2000);
throw new BadRequestException("Invalid license key.");
}
var license = await _userService.GenerateLicenseAsync(user, null);
return license;
}
/// <summary>
/// Used by self-hosted installations to get an updated license file
/// </summary>
[HttpGet("organization/{id}")]
public async Task<OrganizationLicense> OrganizationSync(string id, [FromBody] SelfHostedOrganizationLicenseRequestModel model)
{
var organization = await _organizationRepository.GetByIdAsync(new Guid(id));
if (organization == null)
{
throw new NotFoundException("Organization not found.");
}
if (!organization.LicenseKey.Equals(model.LicenseKey))
{
await Task.Delay(2000);
throw new BadRequestException("Invalid license key.");
}
if (!await _validateBillingSyncKeyCommand.ValidateBillingSyncKeyAsync(organization, model.BillingSyncKey))
{
throw new BadRequestException("Invalid Billing Sync Key");
}
var license = await _getCloudOrganizationLicenseQuery.GetLicenseAsync(organization, _currentContext.InstallationId.Value);
return license;
}
}
View on GitHub (pinned to e93b962371)
Solutions
- Verify the organization id in the cloud admin / organization settings.
- Ensure you are calling the correct environment/region for that org id.
- Confirm the id is a well-formed Guid before submitting.
Defensive patterns
Strategy: validation
Validate before calling
// Validate the id is a well-formed Guid and the target environment is correct before calling.
const GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (!GUID.test(orgId)) throw new Error('Malformed organization id'); Try / catch
try {
const lic = await getOrgLicense(orgId, body);
} catch (e) {
if (e.status === 404) { showOrgNotFoundError(orgId); return; }
throw e;
} Prevention
- Source org ids from live cloud settings, not stale notes.
- Verify the environment/region matches the org id before calling.
- Validate Guid format client-side to avoid malformed-id exceptions.
When it happens
Trigger: Wrong organization id; the organization was deleted; pointing at the wrong environment (e.g. cloud id against a different cloud region).
Common situations: Stale org id copied into configuration; org deleted between config and call; wrong environment.
Related errors
- Invalid Billing Sync Key
- Resource not found.
- Failed to remove organization vault. Please contact support.
- Organization must have at least one confirmed owner.
- Organization already belongs to a provider.
AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13).
Data as JSON: /api/errors/c14d9034c5be5ecc.
Report an issue: GitHub.