Sub topic 4
Preventing the error versus detecting it
This chapter assumes you know what a process step is, can tell an error from a defect (covered earlier in this tutorial), and can read short Python snippets. It covers one decision that comes before you design any poka-yoke device. Should the device stop the error from happening, or catch it right after it happens?
Two timings for the same safeguard
Every mistake-proofing device acts at one of two moments.
- Prevention acts before the error is made. The design makes the wrong action impossible or very hard to perform. A USB-A plug that only fits one way is the standard example.
- Detection acts after the error is made but before it turns into a defect that reaches the next step or the customer. A scale that weighs a kit and flags a missing part is an example. The operator did forget the part, but the kit never leaves the station.
The difference is whether the error ever exists. With prevention, the wrong value is never entered, the wrong part is never fitted, and the wrong button never works. With detection, the error occurs and something has to notice it in time.
Why timing matters
Detection always leaves a gap between the error and its discovery. Three things happen in that gap.
- The error costs something. The part is already machined, the record is already saved, the email is already sent.
- Rework or correction is needed. Someone must fix, scrap, or reverse the result. This is where hidden rework in a Lean sense comes from.
- The detector can fail. Detection depends on a check that must itself be performed correctly, every time. Inspectors tire, sensors drift, and scripts get skipped.
Prevention removes all three, because the detector is built into the design. It does have its own cost. It often needs more upfront design work, and it can be harder to retrofit onto an existing tool.
Detection is still valuable. Some errors cannot be designed out because the step needs human judgment, or because the cause lies upstream. In those cases, catching the error quickly is far better than catching it at final inspection.
Detection comes in grades
"Detection" covers a range. The closer the check sits to the error, the less damage the error does.
| Detection point | What it catches | Gap between error and discovery |
|---|---|---|
| At the step, as the error happens | The wrong action is refused or flagged immediately | None or seconds |
| At the next step (successive check) | The next operator or station rejects the item | One step |
| At the end of the process (final inspection) | A finished defect is found | Whole process |
| After delivery (customer complaint) | A defect has reached the customer | Weeks or longer |
Shingo called the last two kinds judgment inspection. It sorts good from bad but does nothing to reduce how often errors occur. His alternatives were checks that feed information back to the step, and checks at the source of the error. The source-inspection idea gets its own chapter. For now, treat the table as a rule of thumb: pull the check as close to the error as possible, and pull it earlier still if you can.
Seeing the difference in a flow
The diagram below follows one possible error through three designs of the same step.
Notice the length of each path. The late-detection path has the most steps, and each step is a place for cost to build up or for the check to miss.
A worked example in code
Software makes the contrast easy to run. Suppose an order has a shipping option that must be either standard or express. A person typing the value might write expres.
First, the detection design. Orders are saved with any string, and a later audit looks for bad ones.
VALID_OPTIONS = {"standard", "express"}
def audit(orders):
"""Detection: find bad records after they have been saved."""
return [o for o in orders if o["shipping"] not in VALID_OPTIONS]
saved_orders = [
{"id": 1, "shipping": "standard"},
{"id": 2, "shipping": "expres"}, # typo, saved without complaint
{"id": 3, "shipping": "express"},
]
print(audit(saved_orders))Running this prints [{'id': 2, 'shipping': 'expres'}]. The audit works, but order 2 was already stored. Anything that read it before the audit ran, such as a label printer or a billing job, saw the bad value.
Now the prevention design. The value must be a member of an enumeration, a type with a fixed set of allowed values, so a bad string cannot become an order.
from enum import Enum
class Shipping(Enum):
STANDARD = "standard"
EXPRESS = "express"
def make_order(order_id: int, shipping: Shipping) -> dict:
if not isinstance(shipping, Shipping):
raise TypeError("shipping must be a Shipping option, not a string")
return {"id": order_id, "shipping": shipping.value}
print(make_order(1, Shipping.EXPRESS))
try:
make_order(2, Shipping("expres")) # the typo fails here
except ValueError as err:
print("Refused:", err)The typo now fails at the moment it is entered, with a ValueError from Shipping("expres"). No record exists. If a caller passes a raw string such as "express" directly, make_order raises a TypeError, so even a correct-looking string cannot skip the type.
One honest caveat: the prevention here is not absolute. A caller can still pick the wrong valid option, such as STANDARD when they meant EXPRESS. Prevention removes the invalid-value error, not every error. This is why you need to know exactly which error you are proofing, as the earlier chapters on error types explain.
Choosing between them
Use these questions to decide which design fits a given error.
- Can the wrong action be made impossible? If a shape, a type, a lock, or a fixed set of choices can do it, prefer prevention.
- Is the error caused by something outside the step? If a wrong input arrives from upstream, the step cannot prevent it, so detect it at the earliest point of entry.
- What does one escaped error cost? If it costs a life, a legal breach, or a recall, aim for prevention, and add detection as a second layer.
- How often does it happen? A rare error may not justify an expensive device. A cheap detection check may be the right size of response.
- Does the step need human judgment? If so, you may not be able to remove the choice. Make the wrong choice visible and expensive to continue with instead.
Two failure modes show up when teams decide badly.
- Defaulting to detection because it is easy to add. Adding an inspection step feels productive, but the error rate is unchanged, and now there is a new step that can itself be skipped or done carelessly.
- Over-trusting prevention. A device that blocks one error can hide others. If the enum above is the only check, a team may stop looking at whether the right option is picked.
Layering the two
Strong designs often use both. Prevention reduces how many errors occur. Detection catches those that get through, and it also tells you how well the prevention works. For example, the order system could use the enum for typing and also log every refused value. A rising count of refusals shows where users are confused, and that points to a root cause upstream, such as a confusing form.
This layering also shows a limit. If detection is the only layer, you learn about errors but still produce them. If prevention is the only layer, you may never learn which errors people are attempting. Plan for both, and rank them by how much damage each one leaves behind.
Where this leads
This chapter treated detection as one broad category. The next chapter splits it by what the device does once it notices: stop the process, or only signal to someone. Those are control devices and warning devices, and the choice matters because a warning that nobody responds to is equivalent to no detection at all.
Exercise
A warehouse team enters product codes by hand into a scanner screen. Codes are eight characters long. Occasionally a code with a transposed pair of characters (for example, 4F81 instead of 48F1) is accepted and the wrong item is picked. Propose one prevention design and one detection design for this step. State which is closer to the error in time and why.
Show answer
Prevention: replace manual typing with barcode scanning or a pick-from-list, so a person cannot enter a transposed code at all. Alternatively, build a check digit into the code so that a transposed pair makes the code invalid and the screen refuses it. Detection: after entry, compare the code against the open pick list and flag any code not on it, or compare the picked item's weight to the expected weight. Prevention is closer to the error in time because the wrong code never exists. The pick-list comparison detects it a moment after entry but before picking, and the weight check detects it after the wrong item is already in hand.
Exercise
In the shipping example, the audit function finds the misspelled option and the enum prevents it. Name one error that the enum does not prevent, and say whether you would add prevention or detection for it.
Show answer
The enum does not stop a valid but wrong choice, such as selecting STANDARD when the customer asked for EXPRESS. Preventing this needs the choice to come from the customer's actual request, for example by populating the field from the order form instead of asking a person to retype it. If that is not possible, add detection that compares the chosen option with the customer's request or price paid and flags a mismatch before the label prints.