Troubleshooting
When a program fails, first identify which stage reported the problem. The message and traceback include the source location.
| Symptom | Likely cause | What to check |
|---|---|---|
| Parse error | Syntax the grammar does not accept | Braces, commas, string escapes, and function parameter syntax |
| Semantic error | A name, declaration, or statement is invalid in its scope, or a call or attribute can never succeed | Declare names before use; keep import/type/export at module scope; compare the call with the function's parameters and the attribute with the type's fields |
| NameError / AttributeError | A runtime name or member is unavailable | Spelling, module import, and attributes(value) in the REPL |
| TypeError | An operation received an unsupported value type | Constructor inputs, callback return values, and operator operands |
| IndexError / KeyError | A list index or dictionary key is absent | Bounds checks, dict.get(), and list.index() returning nil |
| A found value is treated as missing | index() returned position 0, which is false in a condition | Compare the result with != nil, or use contains() |
| ValueError from split() or replace() | An empty separator or a negative count | Leave count out for no limit; use List(text) for characters |
| IOError / NetworkError | A filesystem or HTTP operation failed | Paths, permissions, connectivity, and a try/catch recovery boundary |
invalid format specifier ".2": precision needs 'f' or 'e' | A precision without a type letter in "{x:.2}" | Write {x:.2f} for decimals or {x:.2e} for scientific notation |
A reliable debugging loop
Reduce the failing code to a small .goblin file, then run it through the
interpreter:
goblin run failing.goblin
Use goblin repl for inspecting values. attributes(value) lists the
operations an object exposes, which is particularly useful for module values,
responses, files, and custom types.
If build-exe fails after a program works with run, verify that the Go
toolchain is installed and run the command again with the generated-build
message visible. Report the Goblin source, command, full error text, and
whether the interpreter path succeeds when filing an issue.
build-exe compiles against the same published Goblin runtime version as the
installed CLI unless it finds a local source checkout (from the working
directory or the executable's location). Development builds without embedded
module-version information use a pinned runtime fallback. When developing
Goblin itself, set GOBLIN_ROOT to the checkout path so compiled programs use
your local runtime.