toeverything/AFFiNE · error · napi::Error

ech_config_required

Error message

ech_config_required

What it means

ech_config_list guard: the request set enable_ech=true but supplied no ech_config_list bytes; ECH cannot be negotiated without the config, so the request is rejected with the sentinel error 'ech_config_required'.

Solutions

  1. Provide the required ECH configuration for the fetch.
  2. Disable ECH if the deployment does not support it.
Defensive patterns

Strategy: validation

When it happens

Trigger: Raised in ech_config_list when a SafeFetch request sets enable_ech to true but does not provide ech_config_list.

Common situations: ECH was requested without supplying the ECH config list. Provide ech_config_list bytes with the request or disable enable_ech.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/01f9f7b362733771. Report an issue: GitHub.

Appendix: source

Thrown at packages/backend/native/src/safe_fetch.rs:251

    allow_private_target_origin: request.allow_private_target_origin,
    ech_config_list: ech_config_list(request)?,
  })
}

fn image_inspection_options(options: ImageInspectionOptions) -> safefetch::ImageInspectionOptions {
  safefetch::ImageInspectionOptions {
    max_width: options.max_width,
    max_height: options.max_height,
    max_pixels: options.max_pixels,
  }
}

fn ech_config_list(request: &SafeFetchRequest) -> anyhow::Result<Option<Vec<u8>>> {
  if !request.enable_ech.unwrap_or(false) {
    return Ok(None);
  }
  let Some(config_list) = request.ech_config_list.as_ref() else {
    anyhow::bail!("ech_config_required");
  };
  Ok(Some(config_list.to_vec()))
}

fn invalid_arg(error: impl ToString) -> Error {
  Error::new(Status::InvalidArg, error.to_string())
}

View on GitHub (pinned to b4c8548c09)