Why did my CodeLab submission return an error response?

Published
Updated

CodeLab returns an error response when your submission doesn’t match the expected logic or output for the challenge. The validator compares your answer against required keys, values, and formatting, and any mismatch will cause the submission to fail.

How validation works

Each challenge includes a set of rules that your code must satisfy. When you click Validate / Run, CodeLab checks your output against these rules and returns a JSON response showing what passed and what failed.

  • Passed checks: These parts of your solution met the expected criteria.
  • Failed checks: These keys, values, or conditions didn’t match what the challenge requires.
  • Error messages: Helpful hints point to what needs correcting.

Common reasons submissions fail

  • Missing or misspelled object keys.
  • Incorrect values or data types.
  • Extra spaces or formatting issues.
  • Returning the wrong variable or object shape.
  • Logic that doesn’t follow the instructions.

Even small differences in structure or formatting can cause validation to fail, so review the error response closely.

How to fix errors

Re-read the challenge prompt, compare your output to the validator’s expected structure, and adjust your code accordingly. You can re-run the exercise as many times as you need.

If you’re still stuck, try reviewing the solution or experimenting with smaller steps until you find the missing piece.

Newsletter