Kuberwastaken/claurst · error

API error

Error message

API error: {}

What it means

Generic re-wrapping sentinel from session-memory extraction: the LLM request used to extract a session summary returned a non-success API result, and the underlying API error is re-raised as "API error: {e}". The fault is the model API call (auth, rate limit, server error), not the local transcript.

Solutions

  1. Check API key validity and quota
  2. Retry the session-memory extraction; transient provider errors are common
  3. Disable session memory extraction if the configured model is unavailable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src-rust/crates/query/src/session_memory.rs:258 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/c3d42a3336e0c577. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/query/src/session_memory.rs:258

        let working_dir_str = working_dir.display().to_string();
        let prompt = build_extraction_prompt(&transcript, &working_dir_str);

        let api_msgs = vec![ApiMessage {
            role: "user".to_string(),
            content: Value::String(prompt),
        }];

        let request = CreateMessageRequest::builder(&self.model, self.max_tokens)
            .messages(api_msgs)
            .system(SystemPrompt::Text(EXTRACTION_SYSTEM_PROMPT.to_string()))
            .build();

        let handler: Arc<dyn StreamHandler> = Arc::new(claurst_api::streaming::NullStreamHandler);
        let mut rx = api_client
            .create_message_stream(request, handler)
            .await
            .map_err(|e| anyhow::anyhow!("API error: {}", e))?;

        let mut acc = StreamAccumulator::new();
        while let Some(evt) = rx.recv().await {
            acc.on_event(&evt);
            if matches!(evt, AnthropicStreamEvent::MessageStop) {
                break;
            }
        }

        let (response_msg, _usage, _stop) = acc.finish();
        let response_text = response_msg.get_all_text();

        if response_text.is_empty() {
            debug!("Session memory extraction produced empty response");
            return Ok(vec![]);
        }

        let memories = parse_extraction_response(&response_text);

View on GitHub (pinned to b0637c97ec)