1use super::code::{Code, Entry, Kind, Severity};
12
13macro_rules! registry {
14 ($($name:ident = $kind:ident $number:literal, $severity:ident, $cause:literal, $remedy:literal;)*) => {
15 impl Code {
16 $(
17 #[doc = $cause]
18 pub const $name: Self = Self::new(Kind::$kind, $number);
19 )*
20 }
21
22 pub(super) static ENTRIES: &[Entry] = &[$(
23 Entry {
24 code: Code::new(Kind::$kind, $number),
25 severity: Severity::$severity,
26 cause: $cause,
27 remedy: $remedy,
28 },
29 )*];
30 };
31}
32
33registry! {
34 E1001 = Error 1001, Breaking,
35 "format could not be determined",
36 "pass the format explicitly, or give the file an extension the reader recognises";
37 E1101 = Error 1101, Breaking,
38 "unterminated quoted value",
39 "close the quote; a value containing a quote character must use the other quote style or a multi-line text field";
40 E1102 = Error 1102, Breaking,
41 "unterminated multi-line text field",
42 "close the field with a semicolon at the start of a line";
43 E1103 = Error 1103, Breaking,
44 "loop_ row count is not a multiple of the column count",
45 "count the values in the final row; an unquoted value containing a space parses as two values";
46 E1104 = Error 1104, Invalidating,
47 "duplicate tag within a category",
48 "remove the repeated tag; the two values cannot both be the value of one item";
49 E1105 = Error 1105, Breaking,
50 "value outside any category",
51 "precede the value with the tag it belongs to, or with a loop_ header";
52 E1106 = Error 1106, Breaking,
53 "missing data_ block header",
54 "add a data_ line before the first category; a file with no block cannot be addressed";
55 E1201 = Error 1201, Invalidating,
56 "malformed fixed-column record",
57 "check the record against its column layout; fields are positional, so one misplaced column shifts every field after it";
58 E1202 = Error 1202, Invalidating,
59 "unparseable numeric field",
60 "correct the field, or read in recover mode to keep the rest of the file";
61 E1203 = Error 1203, Invalidating,
62 "atom serial exceeds format capacity and is not hybrid-36",
63 "re-encode the serial in hybrid-36, or use a format without a five-column serial field";
64 E1301 = Error 1301, Invalidating,
65 "substructure pattern is not valid SMARTS",
66 "correct the pattern at the reported position; only the primitives the pattern model represents are accepted";
67 E1401 = Error 1401, Breaking,
68 "declared length disagrees with the encoded payload",
69 "the file is truncated or corrupt; fetch it again";
70 E1402 = Error 1402, Breaking,
71 "unknown column encoding",
72 "the file uses an encoding this version does not implement; upgrade molframe";
73 E1403 = Error 1403, Breaking,
74 "codec chain type mismatch",
75 "the encoding chain is inconsistent with itself; report it to whatever wrote the file";
76 E1901 = Error 1901, Breaking,
77 "resource limit exceeded",
78 "raise the limit deliberately if the input is genuinely this large; the default guards against decompression bombs and absurd declared row counts";
79 E1902 = Error 1902, Breaking,
80 "source window exceeds the execution memory budget",
81 "reduce the requested window or deliberately raise the execution memory budget";
82 E1903 = Error 1903, Breaking,
83 "source window cannot be represented on this host",
84 "request a smaller window or use a host whose address space can represent it";
85 E1904 = Error 1904, Breaking,
86 "execution cancelled",
87 "start a new execution with an uncancelled context when the result is still needed";
88 E2001 = Error 2001, Invalidating,
89 "required category absent",
90 "add the category, or read with a strictness that tolerates its absence";
91 E2002 = Error 2002, Invalidating,
92 "required item absent",
93 "add the item; without it the affected rows cannot be interpreted";
94 E2003 = Error 2003, Strict,
95 "value outside the declared enumeration",
96 "use one of the enumerated values, or relax strictness to accept the file as deposited";
97 E2004 = Error 2004, Invalidating,
98 "value has the wrong type for its item",
99 "correct the value; a numeric item cannot hold text";
100 E2005 = Error 2005, Strict,
101 "parent-child relationship violated",
102 "add the missing parent row, or correct the child's reference";
103 E2101 = Error 2101, Invalidating,
104 "sequence, alphabet, tree or substitution data is invalid",
105 "check the residue symbols against the alphabet, the tree text against its grammar and the scoring profile against its alphabet";
106 E2201 = Error 2201, Invalidating,
107 "reference table is malformed",
108 "fix the line the message names; a table is accepted whole or not at all, and its header must give name, version, source and licence";
109 E3001 = Error 3001, Invalidating,
110 "column length disagrees with the chunk length",
111 "report this as a molframe bug; a structure cannot be built this way from valid input";
112 E3002 = Error 3002, Invalidating,
113 "child range exceeds the child table",
114 "report this as a molframe bug";
115 E3003 = Error 3003, Invalidating,
116 "overlapping child ranges",
117 "report this as a molframe bug";
118 E3004 = Error 3004, Invalidating,
119 "atom belongs to no residue",
120 "report this as a molframe bug";
121 E3005 = Error 3005, Invalidating,
122 "chain references a nonexistent entity",
123 "check the entity identifiers the chains refer to";
124 E3006 = Error 3006, Invalidating,
125 "bond endpoint out of range",
126 "check the connectivity records; they name an atom the file does not contain";
127 E3007 = Error 3007, Invalidating,
128 "self-bond",
129 "remove the connectivity record bonding an atom to itself";
130 E3008 = Error 3008, Invalidating,
131 "non-finite coordinate without a validity mark",
132 "correct the coordinate, or mark the atom's position as unrecorded";
133 E3009 = Error 3009, Strict,
134 "occupancy outside the zero-to-one range",
135 "correct the occupancy; values outside the range make occupancy-weighted results meaningless";
136 E3010 = Error 3010, Invalidating,
137 "models share a coordinate set but not an atom count",
138 "the models differ in composition and must be held as a ragged ensemble rather than as frames";
139 E3011 = Error 3011, Invalidating,
140 "custom annotation length disagrees with the atom count",
141 "supply exactly one annotation row for every atom row";
142 E3012 = Error 3012, Invalidating,
143 "structures cannot share one merged model axis",
144 "merge structures with equal dense model counts, or keep unlike models as a ragged ensemble";
145 E3013 = Error 3013, Invalidating,
146 "custom annotation types disagree across structures",
147 "convert same-named annotation columns to one physical type before merging";
148 E3014 = Error 3014, Invalidating,
149 "domain extensions would be invalidated by a topology change",
150 "explicitly clear extensions before editing topology or merging structures";
151 E3015 = Error 3015, Invalidating,
152 "residue boundary is not defined by the deposited identifiers",
153 "repair the residue identifiers or explicitly select file-order boundary inference";
154 E3201 = Error 3201, Invalidating,
155 "bundled chemistry reference data is invalid",
156 "reinstall molframe from a verified distribution";
157 E3401 = Error 3401, Invalidating,
158 "topology and coordinate atom counts disagree",
159 "check that the coordinate source and the topology source describe the same system";
160 E4001 = Error 4001, Invalidating,
161 "selection syntax is invalid",
162 "correct the selection at the reported token";
163 E4002 = Error 4002, Invalidating,
164 "selection value is incompatible with its column",
165 "use a value of the column's declared type";
166 E4003 = Error 4003, Invalidating,
167 "selection requires data this structure does not carry",
168 "provide the required annotations or choose a selector available for this structure";
169 E4004 = Error 4004, Invalidating,
170 "unknown selection keyword",
171 "check the spelling against the keyword list; an annotation column can also be selected by its own name";
172 E4005 = Error 4005, Invalidating,
173 "named query is not defined",
174 "define the name before referring to it, or check its spelling";
175 E4006 = Error 4006, Invalidating,
176 "named query definitions refer to each other in a cycle",
177 "break the cycle so that every name eventually resolves to atoms rather than to itself";
178 E4007 = Error 4007, Invalidating,
179 "named query nesting is too deep",
180 "flatten the chain of definitions; each name may refer to at most a bounded depth of other names";
181 E4101 = Error 4101, Invalidating,
182 "atom count exceeds legacy format capacity",
183 "write mmCIF or BinaryCIF, or enable hybrid-36 serials explicitly";
184 E4102 = Error 4102, Invalidating,
185 "chain identifier cannot be represented in the target format",
186 "write mmCIF or BinaryCIF, or supply an explicit chain mapping";
187 E4103 = Error 4103, Invalidating,
188 "residue number exceeds legacy format capacity",
189 "write mmCIF or BinaryCIF, or enable hybrid-36 residue numbers explicitly";
190 E4104 = Error 4104, Invalidating,
191 "coordinate magnitude exceeds the target field width",
192 "translate the structure towards the origin, or write a format with wider coordinate fields";
193 E4105 = Error 4105, Invalidating,
194 "the target format cannot express a required category",
195 "write a format that models the data, or drop the category deliberately";
196 E5001 = Error 5001, Invalidating,
197 "superposition is undefined for fewer than three non-collinear atoms",
198 "widen the selection until it spans three dimensions";
199 E5002 = Error 5002, Invalidating,
200 "degenerate frame from collinear reference atoms",
201 "choose reference atoms that are not in a straight line";
202 E5003 = Error 5003, Invalidating,
203 "empty selection where atoms are required",
204 "check the selection against the structure; a keyword that matches nothing here may match elsewhere";
205 E5004 = Error 5004, Invalidating,
206 "periodic query without a unit cell",
207 "supply a cell, or ask for a non-periodic query";
208 E5005 = Error 5005, Invalidating,
209 "cutoff exceeds half the minimum box dimension under the minimum image convention",
210 "reduce the cutoff, or use a periodic mode that considers more than the nearest image";
211 E5101 = Error 5101, Invalidating,
212 "numeric parameter is not finite or lies outside its valid range",
213 "supply a finite value inside the documented range; no default is substituted for an invalid one";
214 E5102 = Error 5102, Invalidating,
215 "paired inputs do not correspond in length or shape",
216 "give both inputs one entry per matched item, in the same order";
217 E5103 = Error 5103, Invalidating,
218 "too few points or items for the computation",
219 "supply enough input for the operation, for instance three non-collinear points to superpose";
220 E5104 = Error 5104, Invalidating,
221 "the configuration is degenerate or the numerical method did not converge",
222 "choose input that is not degenerate, or relax the explicit tolerance or sweep limit";
223 E5105 = Error 5105, Invalidating,
224 "no valid correspondence or alignment could be established",
225 "check that the inputs share enough matching content, or lower the explicit identity threshold";
226 E6001 = Error 6001, Invalidating,
227 "unqualified identifier while the policy requires explicit namespaces",
228 "qualify the selector, for instance auth_chain rather than chain";
229 E6002 = Error 6002, Invalidating,
230 "requested assembly does not exist",
231 "list the assemblies the entry defines and choose one of them";
232 E6003 = Error 6003, Invalidating,
233 "requested model does not exist",
234 "check the model count; models are addressed by position, not by deposited number";
235 E6004 = Error 6004, Invalidating,
236 "policy field combination is contradictory",
237 "reconcile the two fields; the analysis cannot honour both";
238 E6005 = Error 6005, Invalidating,
239 "verdict profile not found",
240 "list the registered profiles; profile names carry a version";
241 E6006 = Error 6006, Invalidating,
242 "requested chain does not exist",
243 "check the chain count or resolve the chain label before editing";
244 E6007 = Error 6007, Invalidating,
245 "identifier is empty",
246 "supply a non-empty identifier";
247 E6008 = Error 6008, Invalidating,
248 "a whole-ensemble coordinate edit requires shared topology",
249 "edit each ragged model snapshot independently";
250 E6009 = Error 6009, Invalidating,
251 "an atom selected for editing does not exist",
252 "restrict the selection to the structure atom range";
253 E6010 = Error 6010, Invalidating,
254 "assembly operator expression is malformed",
255 "use comma-separated identifiers and integer ranges, with each product factor in parentheses";
256 E6011 = Error 6011, Invalidating,
257 "assembly operator expression exceeds the instance limit",
258 "reduce the operator product or raise the explicit assembly limit";
259 E6012 = Error 6012, Invalidating,
260 "assembly category contains a malformed required value",
261 "correct the named assembly category item and row";
262 E6013 = Error 6013, Invalidating,
263 "assembly generator references an unknown definition",
264 "correct the referenced assembly, operator, or label-asym identifier";
265 E6014 = Error 6014, Invalidating,
266 "non-crystallographic symmetry operator is malformed",
267 "correct the NCS identifier, given/generate code, matrix, or translation vector";
268 E6015 = Error 6015, Invalidating,
269 "crystallographic symmetry metadata or algebraic operation is malformed",
270 "correct the space-group number, operation identifier, or fractional xyz expression";
271 E6016 = Error 6016, Invalidating,
272 "crystal neighbour search configuration is incomplete or invalid",
273 "supply explicit symmetry operators, a valid model, and a positive finite cutoff";
274 E6017 = Error 6017, Invalidating,
275 "crystal neighbour search exceeds its candidate-image limit",
276 "reduce the cutoff or raise the explicit search limit after reviewing the expected cost";
277 E6018 = Error 6018, Invalidating,
278 "space-group setting is unknown or the bundled catalogue is invalid",
279 "supply a valid Hall symbol or International Tables number, or reinstall molframe";
280 E6101 = Error 6101, Invalidating,
281 "workflow graph is invalid",
282 "check that every node's inputs exist, have the right types and form no cycle";
283 E6102 = Error 6102, Invalidating,
284 "execution context configuration is inconsistent",
285 "give at least one worker, and a scratch or temporary-storage size that fits the memory budget";
286 E6103 = Error 6103, Invalidating,
287 "the requested operation is unsupported for this input or policy",
288 "choose a supported input form, a source that offers the capability, or a policy this operation can represent";
289 E6104 = Error 6104, Invalidating,
290 "a policy value is not in the vocabulary of its decision",
291 "use one of the documented words for that decision; names are kebab-case and an underscore is read as a hyphen";
292 E7001 = Error 7001, Invalidating,
293 "operation exceeds the execution memory budget",
294 "raise the memory budget (Python ExecutionContext(memory_budget=...), Rust ExecutionContext::builder().memory_budget(MemoryBudget::new(..)?), CLI --memory-budget, or env MOLFRAME_MEMORY_BUDGET), narrow the selection, or process the input in smaller pieces";
295 E7101 = Error 7101, Invalidating,
296 "input could not be read",
297 "check the path, permissions and that the file is complete and in the expected format";
298 E7102 = Error 7102, Invalidating,
299 "no reference table is available for the computation",
300 "pass a table file, select a cache entry by name, or store one with `molframe data fetch <entry> --manifest <file>`; the library compiles in no table and never fetches during a computation";
301 E7103 = Error 7103, Invalidating,
302 "the reference table asked for conflicts with the one the policy names",
303 "drop the table argument so the policy's table applies, or set the policy field to the table you pass";
304 E7901 = Error 7901, Invalidating,
305 "output could not be written",
306 "check the destination, permissions and available storage, then retry";
307 E9001 = Error 9001, Breaking,
308 "internal invariant violated",
309 "report this as a molframe bug with the input that produced it; no input should be able to cause this";
310 W1001 = Warning 1001, Loose,
311 "trailing content after the final block",
312 "remove the trailing content, or ignore this if the file is deliberately concatenated";
313 W1002 = Warning 1002, Info,
314 "non-standard whitespace or line ending",
315 "normalise the line endings if the file is meant to be portable";
316 W1901 = Warning 1901, Info,
317 "further findings were suppressed",
318 "the retained findings describe the problem; raise the diagnostic ceiling only if you need every occurrence rather than every distinct cause";
319 W2001 = Warning 2001, Info,
320 "unknown category retained but not interpreted",
321 "no action needed; the category survives a preserving write untouched";
322 W2002 = Warning 2002, Info,
323 "unknown item retained but not interpreted",
324 "no action needed; the item survives a preserving write untouched";
325 W2003 = Warning 2003, Loose,
326 "deprecated item used",
327 "migrate to the replacement item named in the dictionary";
328 W3011 = Warning 3011, Info,
329 "residue boundary was inferred from file order by explicit policy",
330 "check the residue identifiers in this region; consecutive residues carry annotations that do not distinguish them";
331 W3012 = Warning 3012, Loose,
332 "an alternate location carries a different component identity",
333 "no action needed; this is one residue modelled with two chemical identities, and both are retained";
334 W3013 = Warning 3013, Loose,
335 "connection partner lies on a symmetry image outside the asymmetric unit and was not lowered to a bond",
336 "no action needed; the connection joins this molecule to a crystal neighbour, so the bond graph of one asymmetric unit has no atom to point at. The deposited row stays in the retained source document; analyse the crystallographic images to use it";
337 W3014 = Warning 3014, Loose,
338 "occupancy outside the zero-to-one range was clamped by explicit policy",
339 "no action needed if clamping is intended; the deposited values are outside the range and the original file still holds them";
340 W3015 = Warning 3015, Loose,
341 "occupancies or B-factors differ between models of one ensemble; the first model's values are kept",
342 "no action needed for coordinates, which are kept for every model; read per-model B-factors from the source file if they matter";
343 W3016 = Warning 3016, Loose,
344 "a connection record names an atom the file does not contain and was not lowered to a bond",
345 "no action needed if the atom was filtered out on purpose; otherwise correct the record's chain, residue number, or atom name. The record itself is kept in the retained headers";
346 W3201 = Warning 3201, Loose,
347 "component not found in any chemical component provider",
348 "layer the full wwPDB dictionary (components.cif.gz from files.wwpdb.org/pub/pdb/data/monomers) as the user dictionary or as the profile's `components:` cache entry, or embed chem_comp_atom and chem_comp_bond rows for this component in the input file; until then its atoms and bonds are not checked";
349 W3202 = Warning 3202, Strict,
350 "observed atoms are inconsistent with the component definition; file connectivity was used",
351 "check the component's atom names against its definition";
352 W3203 = Warning 3203, Loose,
353 "element inferred from the atom name",
354 "declare the element explicitly; the name-based rule is a convention that files are free to violate";
355 W3204 = Warning 3204, Loose,
356 "unusual valence",
357 "check the connectivity and formal charge of the atom named";
358 W3205 = Warning 3205, Info,
359 "chirality was not assessed for a residue",
360 "the reason is named in the finding: the component has no ideal coordinates, they do not align with the model, or its stereocentre geometry is degenerate; supply a dictionary with ideal coordinates to assess it. A centre that was assessed and disagrees is reported as a chirality outlier, not by this code";
361 W3206 = Warning 3206, Loose,
362 "the component definitions embedded in the file are malformed and were ignored",
363 "the component is resolved from a dictionary instead; fix the chem_comp_atom and chem_comp_bond rows in the file, or supply a full dictionary";
364 W3207 = Warning 3207, Loose,
365 "bonds were not perceived because the profile names no bond-reach table",
366 "add a `bond-reach: <name>` line to the profile with a `<name>.reach` table in the cache, or perceive explicitly with a table file; the library compiles in no reach table";
367 W3301 = Warning 3301, Info,
368 "atoms expected by the component definition are absent from the model",
369 "no action needed; the shortfall is reported as coverage rather than hidden";
370 W3302 = Warning 3302, Loose,
371 "chain break detected within a polymer",
372 "no action needed; the gap is unmodelled density and is reported rather than bridged";
373 W4001 = Warning 4001, Loose,
374 "unparenthesised mix of and and or",
375 "parenthesise the expression; and binds more tightly than or, which may not be what was meant";
376 W4002 = Warning 4002, Loose,
377 "float equality comparison",
378 "compare against a range instead; exact equality on a measured quantity rarely matches";
379 W4003 = Warning 4003, Loose,
380 "selection symbol not present in this structure",
381 "check the spelling; the selection is valid but matches nothing here";
382 W4101 = Warning 4101, Strict,
383 "metadata dropped by the target format",
384 "write a format that models the metadata if it matters";
385 W4102 = Warning 4102, Strict,
386 "identifier rewritten to stay unambiguous in the target format",
387 "give each chain and residue its own normalised identifier before writing";
388 W5001 = Warning 5001, Info,
389 "neighbour list rebuilt more often than expected",
390 "increase the skin distance to trade memory for rebuild frequency";
391 W5002 = Warning 5002, Info,
392 "distance matrix requested for a large selection",
393 "use a neighbour query instead; a full matrix grows with the square of the selection";
394 W6001 = Warning 6001, Strict,
395 "per-atom highest occupancy may produce a conformation that was never modelled",
396 "prefer a conformer-consistent altloc policy unless per-atom selection is genuinely intended";
397 W6002 = Warning 6002, Info,
398 "assembly generated multiple instances of a chain",
399 "no action needed; instances carry their own identifiers and are distinguishable";
400 W6003 = Warning 6003, Strict,
401 "analysis returned an indeterminate result",
402 "read the assumptions and coverage; no defensible single answer exists under this policy";
403 W6004 = Warning 6004, Info,
404 "a defaulted policy field materially affects this result",
405 "set the field explicitly so the choice is recorded as yours rather than inherited";
406}
407
408#[cfg(test)]
409#[path = "registry_tests.rs"]
410mod tests;