Every error, warning and hint the checker reports has a code. Errors start with E, warnings with W and hints with H; the first two digits say which part of the language it’s about. This appendix lists them all, each linked to its section in the language reference , which explains it with a short program that produces it.
From the command line, shapescript explain E0401 prints the same section. In the editor, each diagnostic’s code is a link to it.
The ones you’ll meet most are E0401 (sizes that don’t match), E0403 (the wrong number of axes), E0404 (axes that don’t line up by name) and E0501 (a value that doesn’t fit a domain).
Code Meaning
E0101 Unexpected character
E0102 Unterminated string
E0103 Tab used for indentation
E0104 Indentation doesn’t match an enclosing block
E0105 Unmatched closing bracket
E0106 Unclosed bracket
Code Meaning
E0201 Expected a different token
E0202 Unexpected indentation
E0203 Pattern outside a pattern operation
E0204 Invalid pipe stage
E0205 Misused _
E0206 Chained comparison
E0207 Expected a declaration
E0208 Integer too large
W0201 Doc comment not attached to a declaration
Code Meaning
E0301 Unknown name
E0302 Name defined twice
E0303 Name used as the wrong kind of thing
E0304 Dim defined in terms of itself
E0305 Dim isn’t a positive whole number
E0306 Invalid function signature
E0307 Missing return
E0308 Invalid extern fn
Code Meaning
E0401 Sizes don’t match
E0402 Size isn’t divisible
E0403 Wrong number of axes
E0404 Axes can’t be lined up by name
E0405 Tensor has no such axis
E0406 Wrong arguments
E0407 Pattern doesn’t fit the operation
E0408 Axes in a different order
E0409 Size can’t be inferred
E0410 as that can never succeed
E0411 Wrong number of results
E0412 Value isn’t a tensor
E0413 Python value with an unknown shape
E0414 Size too large
E0415 More elements than the axis has
Code Meaning
E0501 Value isn’t in the expected domain
E0502 Wrong dtype
E0503 Invalid domain
E0504 to conversion that doesn’t exist
E0505 Arithmetic on a mask
E0506 Function applied outside its domain
E0507 Indices for an axis of a different size
W0501 Value can be exactly where a function is undefined
Code Meaning
H0601 LaTeX outside the supported subset
H0602 Malformed math in a comment
Code Meaning
E0701 Something from a notebook cell that has to run again
Code Meaning
E0801 Value assigned in a loop or if changes its type
E0802 if on something other than a bool
E0803 Range whose ends aren’t ints
E0804 for over something that can’t be looped over
E0805 Tensor where an int, float or bool is expected
Code Meaning
E0901 Model has no such field
E0902 Invalid model field
E0903 Invalid field initializer
E0904 Value isn’t the expected model
Code Meaning
E1001 Invalid devices declaration
E1002 Unknown devices option
E1003 Devices declared more than once
E1004 devices after other declarations
E1005 Standalone build without devices
E1006 --devices disagrees with the file’s devices
Code Meaning
E1101 mut where it isn’t allowed
E1102 Change to something not passed as mut
E1103 Argument for a mut parameter without mut
E1104 New value for a mut parameter
E1105 Function that can’t be differentiated
E1106 Gradient of something that isn’t a []
E1107 Gradient of a function that doesn’t read the model
E1108 Operation that gradients don’t have
W1101 Param that a differentiated function never reads
Code Meaning
E1201 Call without its Mode
E1202 Value isn’t a Mode
Code Meaning
E1301 Data record has no such field
E1302 Invalid data field
E1303 Value isn’t the expected data
E1304 Invalid dataset stage
Code Meaning
E1401 Logs record has no such metric
E1402 Invalid logs metric
E1403 Value isn’t the expected logs record
E1404 Value isn’t a LogSink
Code Meaning
E1501 Optimizer that isn’t given a model
E1502 Optimizer state or gradient of another model
E1503 Value isn’t the expected optimizer state
E1504 Learning rate that isn’t a number or a Schedule
E1505 update or a gradient transform given the wrong kind of value
Code Meaning
E1601 Value that save can’t write to a checkpoint
E1602 load given something that isn’t a type it can read
E1603 Checkpoint path that isn’t a string
Code Meaning
E1701 Python in an exported function
E1702 extern fn outside torch, called by an exported function
E1703 as on a Python value in an exported function
E1704 Value or operation with no torch-only lowering in an exported function
E1705 Parameter of an export fn that isn’t a tensor with a shape
E1706 return inside an if on a tensor in an exported function
Code Meaning
E1801 Operation across the batch axis with no lowering for several devices
E1802 Batch axis that can’t stay split across the devices
E1803 Device work in a function that runs in the controller
E1804 Whole value passed where a function takes a split one
E1805 Standalone build for several devices
Code Meaning
E1901 Python call given data split across the devices
E1902 Split axis whose size the devices don’t divide
E1903 devices option given twice
E1904 split of something other than a dim
Code Meaning
H2001 The last batch isn’t padded
Code Meaning
E2201 Shape alias defined in terms of itself
E2202 Shape alias where its axes can’t be spliced
E2203 Grouped size like 16gh outside an axis
H2201 16 gh, two axes, where 16gh was probably meant
Code Meaning
E2301 No .ss file for an import
E2302 Files that import each other
E2303 An imported file has errors
E2304 A name an imported file doesn’t declare
E2305 Standalone build of a file with imports
E2306 An import or generic function where it can’t be used
E2307 Functions of the same name for the same model
E2308 No function of that name for the argument’s model
E2309 Misused type variable
E2310 Arguments disagree about a type variable
E2311 A generic function needs a function the model doesn’t have
E2312 A generic function doesn’t check with these types
E2313 Generic functions call each other too deeply
Code Meaning
E2401 Iteration over something that isn’t an axis or a tensor
E2402 Iterator stage that reads the result it builds
E2403 Iterator stage whose function does more than compute a value
E2404 Iterator stage that uses values split across devices
H2401 Sequential loop whose iterations are independent
Code Meaning
W2501 A hand-written module has the generated module’s name
Code Meaning
E2901 An installed package built by a newer ShapeScript
Code Meaning
E3201 Comprehension, which iterator chains replaced
E3202 Lambda outside an iterator stage
E3203 Range outside an iterator chain or a loop
E3204 zip of iterations of different sizes
E3205 Pairs from zip or enumerate used as a value
E3206 Invalid function of map or filter