quickwit-oss/quickwit · error

ack_id {} not found in in-flight

Error message

ack_id {} not found in in-flight

What it means

MemoryQueue.modify_deadlines looks up the ack_id in the in-flight map and bails when it is absent, because deadline extension (visibility timeout renewal) can only apply to a message currently in flight. Once a message is acknowledged or expired/removed, its ack_id is no longer valid.

Source

Thrown at quickwit/quickwit-indexing/src/source/queue_sources/memory_queue.rs:160

        for ack_id in ack_ids {
            if let Some(msg) = inner_state.in_flight.remove(ack_id) {
                inner_state.acked.push(msg);
            }
        }
        Ok(())
    }

    async fn modify_deadlines(
        &self,
        ack_id: &str,
        suggested_deadline: Duration,
    ) -> anyhow::Result<Instant> {
        let mut inner_state = self.inner_state.lock().unwrap();
        let in_flight = inner_state.in_flight.get_mut(ack_id);
        if let Some(msg) = in_flight {
            msg.metadata.initial_deadline = Instant::now() + suggested_deadline;
        } else {
            bail!("ack_id {} not found in in-flight", ack_id);
        }
        return Ok(Instant::now() + suggested_deadline);
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    fn prefilled_queue(nb_message: usize) -> Arc<MemoryQueueForTests> {
        let memory_queue = MemoryQueueForTests::new();
        for i in 0..nb_message {
            let payload = format!("Test message {i}");
            let ack_id = i.to_string();
            memory_queue.send_message(payload.clone(), &ack_id);
        }
        Arc::new(memory_queue)
    }

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Extend the deadline before it expires; ensure the processing loop renews deadlines within the original visibility window.
  2. Handle the Err case by treating the message as expired and reprocessing/re-consuming it rather than retrying with the stale ack_id.
  3. Increase the initial deadline so long processing tasks do not expire mid-flight.

Example fix

// before
queue.modify_deadlines(&stale_ack_id, Duration::from_secs(30)).await?;
// after
if queue.modify_deadlines(&ack_id, Duration::from_secs(30)).await.is_err() {
    // message expired or was acked; re-fetch it instead of extending
    return Err(anyhow::anyhow!("message expired, re-consume required"));
}
Defensive patterns

Strategy: try-catch

Try / catch

match queue.modify_deadlines(&ack_id, deadline).await {
    Ok(_) => { /* deadline renewed */ }
    Err(_) => { /* ack_id expired: drop the message and re-consume; do not retry with stale ack_id */ }
}

Prevention

When it happens

Trigger: Calling modify_deadlines(ack_id, ...) with an ack_id that was already acknowledged, removed after deadline expiry, or never issued for a message in the in-flight map.

Common situations: A processing task takes longer than the visibility deadline, the message expires out of in-flight, and then the task tries to extend its deadline; retry logic holding a stale ack_id; race between acknowledge and modify_deadlines.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/6a5956136642eff8. Report an issue: GitHub.