A computer program expects an input to be a certain value (lets say Value_A). Instead a different value is given (lets say Wrong_Value_B). My company is considering this sentence in such a situation:

"Value_A" was expected, when "Wrong_Value_B" given.

This seems to imply that "I expect A because you gave me B.", which is not correct as it suggests that if, for example, you gave me "C", I might expect some other value than "A".


Is "when" appropriate? Does the sentence require a second "was" before "given"?

Possible Solutions:

I want to say "I need A and only A, no matter what. But you gave me B instead". I have suggested one of these alternatives:

  • "A was expected, but B was given." or
  • "B was given, when A was expected." or
  • "A was expected, B given instead."
  • Welcome to ELU. This seems to be proof-reading. What is the specific doubt in your mind? Is it about the appropriateness of when? What other ways do you think might tell the reader of that message what he needs to know? (Narrowing down your question to its nub will help with tagging as well as answering; "meaning-in-context" isn't right.)
    – Andrew Leach
    Apr 5 at 9:37
  • 1
    What I should have added was asking that you edit everything into your question so it's complete in itself rather than with important details buried in comments. Thank you. Editing the question makes formatting easier than comments, too.
    – Andrew Leach
    Apr 5 at 10:00
  • Reluctant to post an answer because I'm not sure this question is quite on-topic or even what it's looking for, but "when" is potentially ambiguous - it could refer to a hypothetical (if) or be something concessive like although. What kind of answer do you actually want?
    – Stuart F
    Apr 5 at 10:37
  • For error messages, I prefer to indicate clearly the error first and put some precision/comment after. For example, " erroneous value B (A is expected)"
    – Graffito
    Apr 5 at 10:44
  • 1
    @StuartF I edited the post (mostly just rearranging OP's own words) to make the actual questions clearer. I also wrote an answer that quotes you; I hope that's OK! Apr 5 at 13:07

3 Answers 3


You may be confused because there are different meanings for when. Here's one that probably fits the use case you cite:

when adv
5. Whereas; although: She stopped short when she ought to have continued.
TFD Online

So the meaning there is "A was expected, although B was given."

This corresponds pretty closely to your first suggested rewrite: "A was expected, but B was given."


I am not sure if this is really an English language question. Perhaps it would be more appropriate on software engineering.

Some points:

  • we don't necessarily need to follow grammatically correct English for error messages, the important thing is that we are understood
  • there could be thousands of errors generated by a program. In this sense it's often considered desirable to be concise, especially in a historical context when storage was more expensive.

I would tend to go with

Invalid input: "B"; expected: "A".

In this case we start by explaining the problem - there was an invalid input, then we explain what was expected.

I note that for example 30 years ago an MS-DOS computer would have given the message "bad command or file name", where bad is not really the best word here, but it is 'good enough' and is only three characters long. In my version of Windows that has been expanded to "'mdir' is not recognized as an internal or external command, operable program or batch file".

However if we type "dir /ss", then we still see the terse 'Parameter format not correct - "ss"'

This sentence is missing 'the' and 'is'.

Obviously my sentence is more specific in saying the problem 'invalid input', which is no longer than saying "was expected", and communicates the issue immediately.

If you wanted to be as verbose and specific and grammatically correct as possible, then you could go with something like "This function requires the input "A", however "B" was provided".

By the way the original question is a little ambiguous, but we might question the use of 'given'. We would tend to use the verbs 'provided' and 'passed', to refer to values given to functions. However from a style point of view in the context of computer errors I would tend to omit the verb entirely, as if we say 'invalid input', then the fact that we gave/provided/passed an input is already clear from the word input.


Is "when" appropriate?

"When" is correct, but it does lead to some ambiguity, as you've noted. As one commenter has remarked, "it could refer to a hypothetical (if) or be something concessive like although". Those possibilities are in addition to its most common meaning ("at that time").

Does the sentence require a second "was" before "given"?

Yes, the "rules" of English require a second "was" before "given" so that the finite clause has a finite verb. Sometimes it is possible to omit a repeated element (in this case, "was"), but I don't believe that most people would find that to be grammatical in this case.

I have suggested one of these alternatives:

I think that your first suggestion works very well: "A was expected, but B was given." The second option seems to repeat the ambiguity with "when", while the third contains a comma splice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.