# Illegal vs Unwanted States

DevFeed: [Illegal vs Unwanted States](<https://devfeed.tech/articles/illegal-vs-unwanted-states-25485.md>)

Original publisher: [Read original article](<https://buttondown.com/hillelwayne/archive/illegal-vs-unwanted-states/>)

Author: Hillel Wayne

Published: 2026-04-28T15:14:09Z

Content type: article

Language: en

Sources: [Newsletter feed for Hillel Wayne's Newsletter](<https://devfeed.tech/sources/newsletter-feed-for-hillel-wayne-s-newsletter.md>)

Topics: [systems](<https://devfeed.tech/topics/systems.md>), [Software](<https://devfeed.tech/topics/software.md>), [data](<https://devfeed.tech/topics/data.md>), [Network](<https://devfeed.tech/topics/network.md>), [Server](<https://devfeed.tech/topics/server.md>)

Tags: [airline](<https://devfeed.tech/tags/airline.md>), [data](<https://devfeed.tech/tags/data.md>), [data-type](<https://devfeed.tech/tags/data-type.md>), [event](<https://devfeed.tech/tags/event.md>), [network](<https://devfeed.tech/tags/network.md>), [optional](<https://devfeed.tech/tags/optional.md>), [servers](<https://devfeed.tech/tags/servers.md>), [software](<https://devfeed.tech/tags/software.md>), [state](<https://devfeed.tech/tags/state.md>), [systems](<https://devfeed.tech/tags/systems.md>)

## AI overview

The article distinguishes illegal states, which a system must never enter, from unwanted states, which may be temporarily acceptable but must not persist or develop into illegal states. It argues that systems should represent unwanted states because external inputs and unreliable infrastructure make them unavoidable, while detection and resolution mechanisms limit their consequences.

## Source excerpt

An illegal state is a state we never want our system to be in. An unwanted state is a state we don't want to stay in. Many states that we wish were illegal are actually unwanted. Considering a calendaring software which stores calendar events as {user: {events: [event]}}, where each event has a start and end time. This allows one person to attend two events at the same time. We might consider this illegal and replace the data type with {user: {time: optional event}} which makes this impossible. However, a scheduling conflict isn't illegal, only unwanted! It is possible for a person to sign up for two overlapping events. Maybe they're supposed to choose one event, maybe they'll decide which event to go to later, maybe one of the events doesn't actually represent an in-person meeting. In that case it's acceptable, if not ideal, to remain in the unwanted state. Other unwanted states lead to invalid states if not exited quickly. An airline flight is in an unwanted state if there are more passengers booked to fly than seats available. This must be resolved before passengers actually board, as "more passengers physically on the plane than seats available" is an illegal state. In some cases, an unwanted state does not lead to illegal states, but permanently remaining in the unwanted state is still a problem. We might guarantee that a network partition does not ever lead to inconsistent data. Even though the unwanted state of a network partition cannot cause the illegal state of corrupt data, we still have a big problem if we don't ever fix the partition. Why systems must represent unwanted states Generally, unwanted states can happen if we don't have complete control over our system's behavior. We can't guarantee our network is perfectly reliable, our servers are always up, our users all put in correct data. If our system gets input from the external world then the world can push us into an unwanted state. We need to be able to detect these states so we can resolve them. E