sigoden/aichat · error

No last reply found

Error message

No last reply found

What it means

Guard in Input::from_files: the caller requested inclusion of the last reply (--last-reply style composition), but no previous assistant output exists in the session and the current input did not carry an explicit last_reply value. There is simply no prior conversation turn to reference, so the composed input cannot be built.

Solutions

  1. Drop the with_last_reply flag and run without referencing a previous reply
  2. Start a conversation turn first so a last reply exists in the session before composing input with it
  3. Check that the session was loaded correctly — a missing last message may indicate a corrupt or empty session file
  4. Allow an explicit last_reply value on the input as an override, which this code already checks before failing
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/config/input.rs:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09). Data as JSON: /api/errors/0734ea52af981e5f. Report an issue: GitHub.

Appendix: source

Thrown at src/config/input.rs:92

        .await
        .context("Failed to load files")?;
        let mut texts = vec![];
        if !raw_text.is_empty() {
            texts.push(raw_text.to_string());
        };
        if with_last_reply {
            if let Some(LastMessage { input, output, .. }) = config.read().last_message.as_ref() {
                if !output.is_empty() {
                    last_reply = Some(output.clone())
                } else if let Some(v) = input.last_reply.as_ref() {
                    last_reply = Some(v.clone());
                }
                if let Some(v) = last_reply.clone() {
                    texts.push(format!("\n{v}"));
                }
            }
            if last_reply.is_none() && documents.is_empty() && medias.is_empty() {
                bail!("No last reply found");
            }
        }
        let documents_len = documents.len();
        for (kind, path, contents) in documents {
            if documents_len == 1 && raw_text.is_empty() {
                texts.push(format!("\n{contents}"));
            } else {
                texts.push(format!(
                    "\n============ {kind}: {path} ============\n{contents}"
                ));
            }
        }
        let (role, with_session, with_agent) = resolve_role(&config.read(), role);
        Ok(Self {
            config: config.clone(),
            text: texts.join("\n"),
            raw: (raw_text.to_string(), raw_paths),
            patched_text: None,

View on GitHub (pinned to 82976d349a)