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

  1. Verify the organization id in the cloud admin / organization settings.
  2. Ensure you are calling the correct environment/region for that org id.
  3. 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

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


AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13). Data as JSON: /api/errors/c14d9034c5be5ecc. Report an issue: GitHub.