t27.aiРусский

Shortcuts, and reading an error

You will learn

How to read an error message part by part, and four shortcuts that save time.

An error message looks like noise, but it has 4 parts in the same order every time: the kind of error, what it says, the file and the line. The line is where the problem was noticed, so the cause can sit just above it: start reading 1 line before. Keep 4 shortcuts at hand: Cmd+S saves, Cmd+Z undoes, Ctrl+C stops a program in the terminal, and the up arrow brings back the previous command. When you ask your agent for help, paste the whole message, not a retelling of it.

Try it

In the spec, find ERROR_LINE and START_LINE. Change START_LINE to 15 and run the player: the test that wants the start one line above the error fails. Then put it back to 13.

Open the interactive lesson →

Vibecoding 6: the four parts of an error ↗

An error message split into its four parts, in the order you read them, and where to start reading. Lesson 6 of the vibecoding course.

specs/vibecoding/read_an_error.t27

// SPDX-License-Identifier: Apache-2.0
; specs/vibecoding/read_an_error.t27 -- lesson 6 of the vibecoding course: shortcuts, and reading an error
; An error message has four parts, and they come in the same order every time you read it:
; what kind of error, what it says, which file, which line. The line is where the problem was
; noticed, so the cause can sit just above it: open from one line before.
; ASCII only (L3), English only (LANG-EN).
; phi^2 + 1/phi^2 = 3 | TRINITY

module vc_read_an_error;

pub const PART_COUNT : u8 = 4;
pub const PARTS : [4]str = ["kind", "message", "file", "line"];

; Four shortcuts worth knowing on day one (Cmd on a Mac, Ctrl elsewhere).
pub const SHORTCUT_COUNT : u8 = 4;
pub const SHORTCUTS : [4]str = ["Cmd+S", "Cmd+Z", "Ctrl+C", "Up arrow"];
pub const SHORTCUT_MEANINGS : [4]str = [
    "save the file",
    "undo the last edit",
    "stop a program running in the terminal",
    "bring back the previous command"
];

; An error was reported at this line; read from one line before it.
pub const ERROR_LINE : u8 = 14;
pub const START_LINE : u8 = 13;

test an_error_has_four_parts_and_the_line_comes_last {
    assert PART_COUNT == 4;
    assert PARTS[0] == "kind";
    assert PARTS[3] == "line";
}

test four_shortcuts_each_with_a_meaning {
    assert SHORTCUT_COUNT == 4;
    assert SHORTCUTS[2] == "Ctrl+C";
    assert SHORTCUT_MEANINGS[2] == "stop a program running in the terminal";
    assert SHORTCUT_MEANINGS[3] == "bring back the previous command";
}

test start_reading_one_line_above_the_reported_line {
    assert START_LINE == ERROR_LINE - 1;
    assert START_LINE < ERROR_LINE;
}

Open the lesson's spec in the player ↗

All lessons