A human-friendly DSL for ATProto Lexicons
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Docs cleanup

-345
-10
website/content/docs/cli/07-fetch.md
··· 295 295 ### Permission Errors 296 296 297 297 Ensure you have write permissions for the project directory to create `.mlf/`. 298 - 299 - ## Future Features 300 - 301 - Planned enhancements: 302 - 303 - - `--force` flag to re-fetch cached lexicons 304 - - Version pinning (fetch specific lexicon versions) 305 - - Private/authenticated repositories 306 - - Offline mode with local cache 307 - - Fetch from local directories
-335
website/content/docs/cli/08-errors.md
··· 1 - +++ 2 - title = "Error Messages" 3 - description = "Understanding MLF error diagnostics" 4 - weight = 8 5 - +++ 6 - 7 - MLF provides rich, helpful error messages with source code context and suggestions for fixing issues. 8 - 9 - ## Error Format 10 - 11 - All MLF errors follow this format: 12 - 13 - ``` 14 - × Error title 15 - ╭─[file.mlf:5:12] 16 - 5 │ author: ProfileView, 17 - · ^^^^^^^^^^^ error message 18 - ╰──── 19 - help: Suggestion for fixing the issue 20 - ``` 21 - 22 - **Components:** 23 - - **× Error title** - Brief description of the error 24 - - **Source location** - File name, line, and column 25 - - **Source context** - The relevant code snippet 26 - - **Error span** - Highlighted location with `^^^` 27 - - **help:** - Actionable suggestion for fixing 28 - 29 - ## Common Errors 30 - 31 - ### Parse Errors 32 - 33 - #### Expected Token 34 - 35 - ``` 36 - × Expected '}', found ',' 37 - ╭─[thread.mlf:10:5] 38 - 10 │ title: string, 39 - · ^ expected '}' 40 - ╰──── 41 - help: Check for missing closing braces or extra commas 42 - ``` 43 - 44 - **Cause:** Syntax error in MLF code 45 - 46 - **Fix:** Correct the syntax according to MLF grammar 47 - 48 - #### Invalid Identifier 49 - 50 - ``` 51 - × Invalid identifier: '123invalid' 52 - ╭─[thread.mlf:5:5] 53 - 5 │ 123invalid: string, 54 - · ^^^^^^^^^^ identifiers cannot start with numbers 55 - ╰──── 56 - help: Identifiers must start with a letter or underscore 57 - ``` 58 - 59 - **Cause:** Identifier doesn't follow naming rules 60 - 61 - **Fix:** Start identifiers with letters or underscores 62 - 63 - ### Type Errors 64 - 65 - #### Undefined Reference 66 - 67 - ``` 68 - × Undefined reference to 'ProfileView' 69 - ╭─[thread.mlf:8:12] 70 - 8 │ author: ProfileView, 71 - · ^^^^^^^^^^^ 'ProfileView' is not defined 72 - ╰──── 73 - help: Make sure this type is defined in the same file or imported via 'use'. 74 - ``` 75 - 76 - **Causes:** 77 - - Type is not defined 78 - - Type is in another file and not imported 79 - - Typo in type name 80 - 81 - **Fixes:** 82 - - Define the type in the same file 83 - - Use `mlf fetch` to download external lexicons 84 - - Add a `use` statement (if MLF supports imports) 85 - - Check spelling 86 - 87 - #### Type Mismatch 88 - 89 - ``` 90 - × Type mismatch: expected integer, found string 91 - ╭─[thread.mlf:12:15] 92 - 12 │ count: string, 93 - · ^^^^^^ expected integer type 94 - ╰──── 95 - help: Change this to 'integer' or update the constraint 96 - ``` 97 - 98 - **Cause:** Field type doesn't match its definition 99 - 100 - **Fix:** Update the type to match the schema 101 - 102 - ### Constraint Errors 103 - 104 - #### Invalid Constraint 105 - 106 - ``` 107 - × Invalid constraint for type 'integer': 'maxLength' 108 - ╭─[thread.mlf:15:9] 109 - 15 │ maxLength: 100, 110 - · ^^^^^^^^^ 'maxLength' is only valid for string types 111 - ╰──── 112 - help: Use 'maximum' for integer constraints 113 - ``` 114 - 115 - **Cause:** Constraint doesn't apply to the type 116 - 117 - **Fix:** Use the correct constraint for the type: 118 - - String: `maxLength`, `minLength`, `maxGraphemes`, `minGraphemes` 119 - - Integer: `minimum`, `maximum` 120 - - Array: `maxLength`, `minLength` 121 - 122 - #### Constraint Value Error 123 - 124 - ``` 125 - × Constraint value must be positive 126 - ╭─[thread.mlf:18:20] 127 - 18 │ maxLength: -10, 128 - · ^^^ negative value not allowed 129 - ╰──── 130 - help: Use a positive integer value 131 - ``` 132 - 133 - **Cause:** Constraint value is invalid 134 - 135 - **Fix:** Use a valid value according to the constraint rules 136 - 137 - ### Record Errors 138 - 139 - #### Missing Record Key 140 - 141 - ``` 142 - × Record definition must specify a key type 143 - ╭─[thread.mlf:3:1] 144 - 3 │ record main { 145 - · ^^^^^^^^^^^ missing key specification 146 - ╰──── 147 - help: Add 'key: "tid"' or another valid key type to the record 148 - ``` 149 - 150 - **Cause:** Record doesn't specify how records are keyed 151 - 152 - **Fix:** Add a key specification to the record definition 153 - 154 - ### XRPC Errors 155 - 156 - #### Invalid Response Code 157 - 158 - ``` 159 - × Invalid HTTP response code: 999 160 - ╭─[api.mlf:25:5] 161 - 25 │ 999: error, 162 - · ^^^ response code must be between 200-599 163 - ╰──── 164 - help: Use a valid HTTP status code 165 - ``` 166 - 167 - **Cause:** Invalid HTTP status code in query/procedure 168 - 169 - **Fix:** Use standard HTTP status codes (200, 400, 401, 404, 500, etc.) 170 - 171 - #### Missing Required Response 172 - 173 - ``` 174 - × Query/procedure must define at least one success response 175 - ╭─[api.mlf:20:1] 176 - 20 │ query getProfile(...) { 177 - · ^^^^^^^^^^^^^^^^^^^^^ no 200-level responses defined 178 - ╰──── 179 - help: Add at least one 2xx response (typically 200) 180 - ``` 181 - 182 - **Cause:** XRPC method has no success responses 183 - 184 - **Fix:** Add a 200-level response 185 - 186 - ### Union Errors 187 - 188 - #### Empty Union 189 - 190 - ``` 191 - × Union must have at least one type 192 - ╭─[thread.mlf:30:15] 193 - 30 │ data: unit | , 194 - · ^ empty union 195 - ╰──── 196 - help: Add at least one type to the union 197 - ``` 198 - 199 - **Cause:** Union has no types 200 - 201 - **Fix:** Add types to the union: `string | integer` 202 - 203 - #### Duplicate Union Types 204 - 205 - ``` 206 - × Duplicate type in union: 'string' 207 - ╭─[thread.mlf:32:20] 208 - 32 │ data: string | string, 209 - · ^^^^^^ duplicate type 210 - ╰──── 211 - help: Remove duplicate types from the union 212 - ``` 213 - 214 - **Cause:** Same type appears multiple times in union 215 - 216 - **Fix:** Remove duplicates 217 - 218 - ## Validation Errors 219 - 220 - ### Record Validation 221 - 222 - ``` 223 - ✗ Record validation failed with 2 error(s): 224 - • Field 'title' is required but missing 225 - • Field 'count': expected integer, found "123" 226 - ``` 227 - 228 - **Cause:** JSON record doesn't match lexicon schema 229 - 230 - **Fix:** Update the JSON to match the schema 231 - 232 - ## Generation Errors 233 - 234 - ### File Read Error 235 - 236 - ``` 237 - Failed to read file: permission denied 238 - ``` 239 - 240 - **Cause:** Cannot read input file 241 - 242 - **Fix:** Check file permissions and path 243 - 244 - ### Type Resolution Error 245 - 246 - ``` 247 - Type resolution error: circular reference detected 248 - ``` 249 - 250 - **Cause:** Types reference each other in a cycle 251 - 252 - **Fix:** Break the circular dependency 253 - 254 - ### Code Generation Error 255 - 256 - ``` 257 - Generator 'typescript' not found 258 - ``` 259 - 260 - **Cause:** Generator feature not enabled 261 - 262 - **Fix:** Install with `--features typescript` or use `--all-features` 263 - 264 - ## Fetch Errors 265 - 266 - ### DNS Error 267 - 268 - ``` 269 - ✗ DNS lookup failed: No TXT record found for _lexicon.place.stream 270 - ``` 271 - 272 - **Cause:** Domain has no lexicon TXT record 273 - 274 - **Fix:** Verify the namespace is correct and has published lexicons 275 - 276 - ### Network Error 277 - 278 - ``` 279 - ✗ Failed to fetch lexicon records: connection timeout 280 - ``` 281 - 282 - **Cause:** Network connectivity issues 283 - 284 - **Fix:** Check internet connection and try again 285 - 286 - ### Parse Error 287 - 288 - ``` 289 - ✗ Failed to parse lexicon JSON: unexpected end of input 290 - ``` 291 - 292 - **Cause:** Malformed JSON from remote repository 293 - 294 - **Fix:** Report issue to namespace maintainer 295 - 296 - ## Exit Codes 297 - 298 - All MLF commands use standard exit codes: 299 - 300 - - `0` - Success 301 - - `1` - Error occurred 302 - 303 - Use in scripts: 304 - 305 - ```bash 306 - if mlf check; then 307 - echo "✓ Valid" 308 - else 309 - echo "✗ Invalid" 310 - exit 1 311 - fi 312 - ``` 313 - 314 - ## Tips for Reading Errors 315 - 316 - 1. **Read the title** - Gives you the high-level issue 317 - 2. **Check the location** - Find the exact line and column 318 - 3. **Examine the span** - See what code is problematic 319 - 4. **Follow the help** - Actionable suggestions for fixes 320 - 5. **Look for patterns** - Similar errors often have similar fixes 321 - 322 - ## Reporting Bugs 323 - 324 - If you encounter an error that seems like a bug: 325 - 326 - 1. Note the exact error message 327 - 2. Create a minimal reproduction case 328 - 3. Check if it's a known issue 329 - 4. Report at: https://github.com/anthropics/claude-code/issues 330 - 331 - Include: 332 - - MLF version (`mlf --version`) 333 - - Complete error message 334 - - Minimal MLF code that reproduces the issue 335 - - Expected behavior vs actual behavior