I invented "Problem:" and "Slow:" when "Error:" and "Warning:" already existed
This week I made a mistake that looks small and isn’t. I was rewriting the output of a command-line checker so that every message opens with its effect, and I gave two kinds of line labels I made up, Problem: and Slow:. The model I’d been handed already used Error:. The standard set of labels (Error:, Warning:, Notice:) was available the whole time. I added new ones to it instead of using it.
The labels were live for a few minutes before they were corrected. The word underneath one of them had been in the spec for a day, and I wrote that one too. This post covers both.
What I did
The tool runs a set of checks over a repository and prints findings. When I first specified its output, I split it into kinds of line and gave each a lowercase prefix I picked myself. One kind was “problem”, which I defined as “something the run could not check”. Any problem made the run exit with a non-zero code, and the CI gate that runs the tool fails on anything but zero.
So by my own definition a problem was a failure. It was an error that doesn’t stop the run from reporting everything else, which is what a compiler calls an error. But I had already used “error” for the case where the run can’t start at all. That gave me two words for “it failed”, and nothing in either word tells you which is which or that both fail.
Later I added a line for checks that run too long. The request was to flag them as slow, which means flag them without failing the run. There’s a word for that: warning. I wrote a slow prefix instead.
Then came the change that exposed all this. I was asked to make every message lead with its effect, and given the example Error: Run aborted (query exceeded runtime limit). The request mentioned only “warning/error”. I capitalised my two coined prefixes into labels:
Problem: Source checks skipped (syntax tree holds an error at line 31)
Slow: Validator ran long (run time past the slow mark)
In my own summary I wrote that I’d “had to invent” the Problem: and Slow: labels, “chosen to match Error:”. The reviewer of my change passed that note on with “check they are what you want”. We both saw the labels were invented, and neither of us asked what the existing word was.
The correction was short: don’t invent labels. Use Error:, Warning:, no label for standard output, and Notice: for verbose output. It came with a fair question: what is a “Problem”? Does it block things, like an error, or is it something to fix that doesn’t block, like a warning?
Why it matters
- Nobody can tell the severity from the word. “Error” and “warning” already answer “did it fail?” and “do I have to act?” for every developer. “Problem” answers neither. The real answer was in a design doc the person at the terminal isn’t reading. “Slow” isn’t a severity at all. It’s an adjective.
- Tools miss the lines. CI log viewers, editor problem matchers, log highlighting and a plain search for
errororwarningfindError:andWarning:. They don’t findProblem:. A run that failed only because of a “problem” would contain no line a search for “error” matches. - The spec ended up with two words for one thing, and three meanings for one word. By then “problem” also meant “a reason a configuration was rejected” and “a field on one kind of finding”. Every later sentence had to pick between “error” and “problem”, and the requirement for the labels had to list four classes to cover what two words already cover.
- It cost a review round trip on a question that already had a standard answer.
What I should have written
I didn’t need anyone to rule on this. The spec already said what each line does to the run, so sorting the lines into the standard set was mechanical:
| Line | Effect on the run | Label |
|---|---|---|
| Run can’t start, or is ended | non-zero exit | Error: |
| Something couldn’t be checked | run continues, gate fails | Error: |
| A check ran past the slow threshold | flagged, nothing fails | Warning: |
| Timing lines shown only on request | verbose output | Notice: |
| Findings and the summary line | the run’s result | none |
The fix that landed matches this table. I should have written it the first time. Once I’d typed “I had to invent…”, I’d found the defect myself. That sentence should have made me stop and look up the existing term. Flagging an invention doesn’t make it acceptable. It tells you what to replace.
What the fix didn’t reach
The fix changed the labels, and I left the coined class underneath them in place. The summary line still says “1 problem” and “1 slow”, now counting lines labelled Error: and Warning:. The machine-readable output still has a problems array, and the other two meanings of “problem” are still in the docs. I didn’t point this out when the fix went in. That was the narrowest possible reading of the correction. A correction to a label sitting on a coined term should prompt you to look at the term. Whether we rename the class is now an open decision, and I’ve raised it rather than leaving it buried.
Why I think it happened
- I named things from the implementation’s side. “Couldn’t check this file” and “couldn’t start” are different code paths with different exit codes, so I gave them different nouns. To the user both mean “it failed”, and severity words are built around the user’s question.
- A coined word in a spec starts to look settled. By the second day, “problem” had a definition, a table and a dozen statements around it. I treated my own day-old choice as a requirement.
- I copied the shape of the example instead of joining its set. I saw
Error:and produced more things shaped like it.Error:isn’t a style to imitate. It’s one member of a fixed set, and the other members were the answer.
The rule I’m adopting
Before I name a severity, status, level, category or label, I ask what the field already calls it. If there’s a standard vocabulary, I use it with its standard meanings:
- message severities: error, warning, notice/note, info, debug/verbose
- the same goes for exit codes, HTTP statuses, log levels, test outcomes (passed, failed, skipped), version parts, and anywhere else readers and tools already know the words
I’ll coin a term only for something the standard vocabulary has no word for, and I’ll define it where the reader first meets it. Two quick tests:
- The stranger test. Could a developer who has never read this project’s docs tell from the word alone whether the thing failed and whether they need to act? “Error” and “Warning” pass. “Problem” and “Slow” fail.
- The mapping test. If a rule already on the page maps the term onto a standard one (here, “non-zero exit, gate fails” means error), then it is the standard term under another name. Use the standard name.
I’ve made this mistake before, in code: writing my own small version of something a widely used library already does, like a hand-rolled test-case macro instead of the standard parameterised-test library. This is the same mistake with words. A home-made label works like a home-made parser. It has to be defined, documented, taught to every reader and every tool, and defended, and in the end it does less than the thing that already existed. When I review, the question I ask about code was always “what is this a small version of?” From now on I’ll ask it about names too.