Foundations of Context Engineering · Topic 1 of 3

Context Failure Modes and Their Fixes

Databricks Context Engineer: tell context poisoning, distraction, confusion and clash apart in an agent trace and pick the technique that fixes each.

  • 5 min
In a nutshell
  • Poisoning is false content reused as fact; confusion is irrelevant content used; clash is relevant content that contradicts; distraction is overall length.
  • Ask "false, too long, unneeded or contradictory?" to name the mode in one step.
  • Poisoning fixes validate and remove; distraction fixes compact or offload; confusion fixes scope and filter; clash fixes reconcile to one source.

What it is

An agent answers from whatever sits in its context window: the system prompt, conversation history, retrieved chunks, tool definitions and tool results. When that content is wrong, too long, irrelevant or contradictory, the answer degrades even though the model and the data are fine.

The exam names four context failure modes and expects you to read a trace, name the mode and pick the technique that fixes it most directly. Each mode has a different cause, so each has a different fix.

Agent traceFind the bad contentwrong, too long, unneeded, contradictoryName the modeApply the matching fix

How it works

The four failure modes

Failure modeWhat happensTypical trace evidence
Context poisoningAn error or hallucination enters the context and is reused as factA wrong value from an early step is cited again in later steps and plans
Context distractionThe context grows so long the model over focuses on it and neglects what it learned in trainingA long session where the agent repeats past actions instead of reasoning freshly
Context confusionSuperfluous content, such as unneeded tools or documents, is used and lowers qualityThe answer draws on a document or calls a tool that has nothing to do with the request
Context clashParts of the context contradict each otherTwo instructions or two sources disagree and the answer follows the wrong one or wavers

The test that separates them is the question "what is wrong with the content?". Poisoning means the content is false. Distraction means there is too much of it overall, confusion means some of it does not belong, and clash means two relevant pieces disagree.

Telling close pairs apart

Confusion and clash are the pair most often mixed up. In confusion, the extra content is irrelevant to the task, such as a prior session about a different contract that leaks into today's answer. In clash, both pieces are relevant but say different things, such as a system prompt rule that says "apply the 2025 policy" while the retrieved document is the 2026 policy.

Poisoning and confusion also look alike. Poisoning needs a false statement that the agent itself treats as true and keeps reusing, often a hallucinated tool result or a wrong summary. Irrelevant but true content is confusion, not poisoning.

Distraction is about size, not about any single item. The trace shows a very long history, and the agent leans on patterns in that history rather than on its own knowledge of how to solve the problem.

Matching the technique to the failure

Failure modeMost direct technique
PoisoningValidate tool results and summaries before they enter context or memory; remove the bad item or restart the thread from a clean, verified state
DistractionCompact the history into a summary plus recent items, or offload detail to notes outside the window
ConfusionLoad a minimal tool set for the task, filter and scope retrieval, drop unrelated history
ClashRemove or replace the outdated item, give one authoritative source, make instruction priority explicit

A bigger context window does nothing for poisoning or clash, and it usually makes distraction worse.

Wrong fact reusedValidate and removepoisoningToo much historyCompact or offloaddistractionIrrelevant tools or docsScope and filterconfusionContradictionKeep one sourceclash

Reading a trace

MLflow 3 tracing records each step, tool call and retrieved context, so you can see exactly what the model saw when it went wrong. Work backward from the bad output: find the sentence in the answer that is wrong, then find the context span it came from.

If that span is a retrieved chunk from an unrelated document, think confusion. If it is the agent's own earlier output that was wrong, think poisoning, and if two spans disagree, think clash.

How the exam asks about this

  • "A support agent answers today's billing ticket but mentions product names that appear only in an earlier, unrelated ticket still loaded in the window." This is context confusion; drop the unrelated history from the window.
  • "A tool returned an error message that the agent summarized as a successful result, and every later step builds on that success." This is context poisoning; validate results before they enter context and restart from the last verified state.
  • "The system prompt says to quote list prices while the retrieved pricing table says all quotes use contract prices." This is context clash; make one source authoritative and remove the conflicting instruction.

What to remember for the exam

  • Poisoning is false content reused as fact; confusion is irrelevant content used; clash is relevant content that contradicts; distraction is overall length.
  • Ask "false, too long, unneeded or contradictory?" to name the mode in one step.
  • Poisoning fixes validate and remove; distraction fixes compact or offload; confusion fixes scope and filter; clash fixes reconcile to one source.
  • Read the MLflow 3 trace backward from the wrong sentence to the context span that caused it.
  • A larger context window is almost never the direct fix for any of the four modes.
Watch out

Do not call content "poisoned" just because it is irrelevant. Poisoning needs a false statement the agent keeps reusing; unrelated but accurate content is context confusion.

Common mistakes

Fixing size when the problem is content. Compaction shortens the history but faithfully keeps a poisoned fact or a contradiction in the summary. Remove or correct the bad item first, then shrink the context if it is still long.

Mixing up confusion and clash. Both involve unwanted content, but clash needs two relevant pieces that disagree. If one piece simply does not belong to the task, the fix is to drop it, not to reconcile it.

Blaming the model. Switching to a stronger model rarely helps when the trace shows bad context. The exam answer is the context change that removes the cause, not a model upgrade.

Check yourself

  • An agent hallucinates a customer ID in step 2 and uses it in every later tool call. Which failure mode is this?

    Context poisoning, because a false value entered the context and is reused as fact; validate tool inputs and restart from a verified state.

  • Which failure mode is most directly fixed by loading only the tools a task needs?

    Context confusion, because unneeded tool definitions are superfluous content the model may use, lowering response quality.

  • Why does compaction not fix context clash on its own?

    The summary can keep both contradicting statements, so you must first decide which source is authoritative and remove the other.

Topic 1 of 3 in Foundations of Context Engineering

Test yourself on Foundations of Context Engineering

The full Databricks Context Engineer Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.