toeverything/AFFiNE · error · napi::Error

Action recipe not found

Error message

Action recipe not found

What it means

copilot_action_recipe NAPI function could not resolve the requested recipe: either the version is not 'v1' or the action_id has no matching recipe in the embedded catalog, so an InvalidArg error is returned to the JS caller.

Solutions

  1. Use an action id present in the catalog.
  2. Register the missing action recipe.
Defensive patterns

Strategy: validation

When it happens

Trigger: Returned by copilot_action_recipe when the requested action_version is not v1 or the action_id does not match any built-in recipe such as mindmap.generate, slides.outline, transcript.audio, or the image.filter actions.

Common situations: The requested copilot action id or version is not registered in the native catalog. Check the action id spelling and use version v1.


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

Appendix: source

Thrown at packages/backend/native/src/llm/action/catalog.rs:20

use serde::Serialize;
use serde_json::{Value, json};

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ActionRecipe<'a> {
  action_id: &'a str,
  action_version: &'a str,
  slot: &'a str,
  prompt_ref: &'a str,
  response_contract: Value,
  output_projection: &'a str,
}

#[napi_derive::napi]
pub fn copilot_action_recipe(action_id: String, action_version: Option<String>) -> Result<String> {
  let version = action_version.as_deref().unwrap_or("v1");
  if version != "v1" {
    return Err(Error::new(Status::InvalidArg, "Action recipe not found"));
  }
  let recipe = match action_id.as_str() {
    "mindmap.generate" => structured(&action_id, "mindmap.generate", text_result_schema()),
    "slides.outline" => structured(&action_id, "slides.outline", text_result_schema()),
    "transcript.audio" => structured(
      &action_id,
      "Transcript audio structured",
      super::super::contract_schema::transcript_result_schema(),
    ),
    "image.filter.sketch" | "image.filter.clay" | "image.filter.anime" | "image.filter.pixel" => ActionRecipe {
      action_id: &action_id,
      action_version: "v1",
      slot: match action_id.as_str() {
        "image.filter.sketch" => "action.image.filter.sketch",
        "image.filter.clay" => "action.image.filter.clay",
        "image.filter.anime" => "action.image.filter.anime",
        _ => "action.image.filter.pixel",
      },

View on GitHub (pinned to b4c8548c09)