bitwarden/server · error · NotFoundException

Resource not found.

Error message

Resource not found.

What it means

Thrown as NotFoundException by UpdateConnection (PUT /organizations/connections/{id}) when the request body model is null — i.e., the client sent an empty body or one that failed to bind to OrganizationConnectionRequestModel. The controller intentionally returns 404 (not 400) for a missing body, which is a deliberate choice to avoid leaking information about route validity. Maps to HTTP 404.

Source

Thrown at src/Api/AdminConsole/Controllers/OrganizationConnectionsController.cs:83

        }

        switch (model.Type)
        {
            case OrganizationConnectionType.CloudBillingSync:
                return await CreateOrUpdateOrganizationConnectionAsync<BillingSyncConfig>(null, model, ValidateBillingSyncConfig);
            case OrganizationConnectionType.Scim:
                return await CreateOrUpdateOrganizationConnectionAsync<ScimConfig>(null, model);
            default:
                throw new BadRequestException($"Unknown Organization connection Type: {model.Type}");
        }
    }

    [HttpPut("{organizationConnectionId}")]
    public async Task<OrganizationConnectionResponseModel> UpdateConnection(Guid organizationConnectionId, [FromBody] OrganizationConnectionRequestModel model)
    {
        if (model == null)
        {
            throw new NotFoundException();
        }

        var existingOrganizationConnection = await _organizationConnectionRepository.GetByIdOrganizationIdAsync(organizationConnectionId, model.OrganizationId);
        if (existingOrganizationConnection == null)
        {
            throw new NotFoundException();
        }

        if (!await HasPermissionAsync(existingOrganizationConnection.OrganizationId, existingOrganizationConnection.Type))
        {
            throw new BadRequestException("You do not have permission to update this connection.");
        }

        if (model.Type != existingOrganizationConnection.Type)
        {
            throw new BadRequestException("The connection type cannot be changed.");
        }

View on GitHub (pinned to e93b962371)

Solutions

  1. Send a well-formed OrganizationConnectionRequestModel JSON object in the PUT body.
  2. Set the Content-Type header to application/json (and ensure the body is not empty).
  3. Verify the client serializer actually wrote the object and the stream was not disposed early.
  4. Add an integration assertion that the request body is non-empty before sending.

Example fix

// before
await client.PutAsync($"organizations/connections/{id}", null);
// after
var json = new StringContent(JsonSerializer.Serialize(model), Encoding.UTF8, "application/json");
await client.PutAsync($"organizations/connections/{id}", json);
Defensive patterns

Strategy: validation

Validate before calling

if (model == null) throw new ArgumentNullException(nameof(model));
var json = JsonSerializer.Serialize(model);
if (string.IsNullOrWhiteSpace(json) || json == "null")
    throw new InvalidOperationException("Request body must be a non-null OrganizationConnectionRequestModel.");

Prevention

When it happens

Trigger: PUT /organizations/connections/{organizationConnectionId} with an empty request body, a Content-Type that prevents model binding (e.g., missing application/json), or a malformed JSON payload that the binder rejects as null.

Common situations: A client sending PUT with no body; a proxy stripping the body; a Content-Type header set to text/plain or omitted so the JSON binder never runs; a serialization bug on the client that emits an empty stream.

Related errors


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