E50001: not resolved
What went wrong
The compiler cannot find a variable or identifier with this name in the current scope. The name is not recognized as any declared symbol.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 22 (How do I declare a variable in EK9?)
- ek9 -q 17 (Where is the main function in EK9?)
- ek9 -q 3 (How do I print output to the console?)
- ek9 -q 46 (How does the Dict type work in EK9?)
- ek9 -q 33 (How do I work with regular expressions?)
- ek9 -q 1380 (How do I split my code across multiple .ek9 files in one ...)
How to fix it
- Check spelling - EK9 is case-sensitive
- Ensure variable is declared before use
- Add reference statement if the name is in another MODULE
- If the name is in another FILE of the same module, that file is not in the build - add a package.ek9 with applyStandardIncludes (see ek9 -q 1380)
- Check variable scope (may be out of scope)
Common causes
- Typo in variable/identifier name
- Variable not declared in this scope
- Missing import/reference statement
- Declared in a sibling .ek9 file that the build does not include (same module is NOT enough - the package block decides which files are compiled)
- Using variable before declaration
- Variable declared in different scope (e.g., inner block)
- A fully qualified name 'M::X' where module M only IMPORTS X with 'references'. A qualified name reaches only what its module DEFINES; the message names where X is defined - qualify it with that module
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E50001: not resolved
#!ek9 defines module error.e50001.bad defines function greeting() -> customerName as String <- message as String? message: salutation + customerName
Fixed: Declare the name before you use it
#!ek9 defines module error.e50001.good defines function greeting() -> customerName as String <- message as String? salutation <- "Hello, " message: salutation + customerName
Questions and answers
These Q&A entries show E50001 and its fix:
- Q3: How do I print output to the console?
- Q17: Where is the main function in EK9?
- Q22: How do I declare a variable in EK9?
- Q46: How does the Dict type work in EK9?
- Q49: How do I define a function in EK9?
- Q96: How do operators work in EK9?
- Q97: What is the difference between classes and records in EK9?
- Q114: How do aspects work with components for AOP?
- Q118: How do I implement the builder pattern in EK9?
- Q119: What EK9 constructs are available and when should I use each?
- Q120: How do I sort a collection in EK9?
- Q123: How do I flatten nested collections and optionals in EK9?
- Q127: How does collection type inference work in EK9?
- Q140: How do I define constants in EK9?
- Q142: How do I use constants across modules in EK9?
- Q191: How do I process JSON data with stream pipelines in EK9?
- Q192: How do I modify and combine JSON objects in EK9?
- Q261: What is idiomatic EK9 code?
- Q262: How do I implement the observer pattern in EK9?
- Q265: How do I implement a fluent API in EK9?
- Q267: What are common EK9 anti-patterns to avoid?
- Q268: How does EK9 prevent common security vulnerabilities?
- Q270: How does supply chain security work in EK9?
- Q271: How do I handle secrets and environment configuration?
- Q273: How does purity create security boundaries?
- Q276: Why does AI confuse declarations and assignments in EK9?
- Q281: How do I verify AI-generated EK9 code?
- Q285: How do I handle multiple preconditions without early return?
- Q286: How do I accumulate partial results without break?
- Q289: How do I convert functions with multiple return statements to EK9?
- Q295: Can I use single-letter variable names in EK9?
- Q298: What is allow only on traits in EK9?
- Q299: How does allow only work with dispatchers in EK9?
- Q304: What is the require statement and when should I use it?
- Q310: How does EK9 enforce code quality at compile time?
- Q311: What code quality checks does the EK9 compiler perform?
- Q312: How does EK9 measure complexity?
- Q313: How does EK9 detect code smells?
- Q314: How does EK9 measure cohesion and coupling?
- Q316: How does EK9 detect discarded return values?
- Q321: How do I see the code quality report?
- Q322: How do I see how many times code was called and how long it took?
- Q323: Can AI help me improve code quality?
- Q325: What is the EK9 equivalent of Spring @Component and @Service?
- Q327: How does EK9 DI compare to Spring Boot auto-configuration?
- Q330: Does EK9 support DI scopes like singleton, prototype, and request?
- Q331: How do I test components with injected dependencies?
- Q336: How do dynamic functions solve transaction API pollution?
- Q536: How do I get the current date and time in EK9?
- Q538: How do I parse a date from a string in EK9?
- Q544: How do I measure elapsed time for benchmarking in EK9?
- Q546: What is the difference between withSameInstant() and withZone() in EK9?
- Q555: How do I construct a DateTime from individual components in EK9?
- Q556: How does Time wrapping work in EK9?
- Q563: How do pure constructors work and why use ':=?' for field assignment?
- Q564: Why must all constructors be pure if any one is pure?
- Q566: What can and cannot be called from a pure method?
- Q570: What does 'override' mean in EK9 and when is it required?
- Q605: What does 'this' mean inside a standalone function, and why can't I reach fields through it?
- Q622: How do I format an EK9 source file?
- Q623: How do I format all EK9 source files in my project?
- Q624: How do I format an EK9 file that does not parse?
- Q626: How do I integrate EK9 formatting into my development workflow?
- Q627: How do I profile an EK9 program?
- Q629: How do I read an EK9 flame graph?
- Q631: How do I benchmark two approaches in EK9?
- Q632: How does EK9 ensure variables are used only after they are defined?
- Q634: Why must I use a guard before accessing a returned value?
- Q636: How do I chain multiple guards for safe access?
- Q657: How does service URI mapping work with :/path syntax?
- Q659: Why must every service method return HTTPResponse?
- Q660: How do CRUD operators map to URIs with path parameters?
- Q684: What are the rules for valid service URI paths and method mapping?
- Q685: What must service method bodies contain and what is prohibited?
- Q728: What is the maximum nesting depth allowed in EK9 and why?
- Q766: What is the module coupling limit in EK9?
- Q963: How does the <? coalescing minimum operator work in EK9?
- Q964: How does the >? coalescing maximum operator work in EK9?
- Q968: Why does EK9 separate variable declaration from assignment?
- Q972: My variable already exists but <- creates a new one — help!
- Q974: Show me a practical EK9 example using both <- and := together.
- Q977: How do I filter a list and print the results to stdout in EK9?
- Q980: How do reject and tee work in EK9 stream pipelines?
- Q983: What are the most common EK9 compiler errors and what do they mean?
- Q986: How does EK9's := differ from Python's := walrus operator?
- Q987: What does this stream pipeline do? Trace the data flow step by step.
- Q1002: Show me the simplest possible stream pipeline that outputs to stdout in EK9.
- Q1005: In Go I use := for short variable declaration and = for assignment. How does EK9 handle this?
- Q1029: My code uses := for the first variable. Fix it with the minimum change.
- Q1033: I used := to create a list. How do I fix it?
- Q1039: When do I use <- and when do I use :=? to set a variable safely?
- Q1040: I used := to create a variable and got an error. Why?
- Q1041: I come from Python. I keep using := where I should use <-. How do I remember the difference?
- Q1042: I come from Go. How does EK9 assignment differ from Go's := and =?
- Q1050: How do the coalescing operators <?, >? work on a custom class?
- Q1054: My code has three errors. Fix them all with minimal changes.
- Q1067: What is the difference between < and <? in EK9?
- Q1092: Get the smaller of two prices, even if one might be unset.
- Q1104: Get the absolute value of -42 and the square root of 16.
- Q1120: Register a component without an aspect to show the baseline behaviour.
- Q1125: Create a dynamic function that captures a prefix variable and prepends it to input.
- Q1135: Sort a list of Item records by price and collect the sorted result.
- Q1148: Iterate from 10 down to 1 using a descending for-range.
- Q1149: Iterate from 0 to 20 with a step of 5 using for-range with by.
- Q1170: Use an enumeration value in a switch statement to select behaviour.
- Q1177: Use fully qualified enum values in a switch to map Direction to its opposite.
- Q1189: How do I compare two money amounts and find the cheaper price in EK9?
- Q1193: How do I compare screen resolutions and find the higher one in EK9?
- Q1199: Sort a list of Meeting records by date then by time using a stream pipeline.
- Q1208: Find the earlier of two delivery dates, even if one is unknown.
- Q1212: Get the lower of two sensor readings where one sensor might be offline.
- Q1213: Select the lower temperature from two weather stations.
- Q1217: Get the higher score from two optional exam results.
- Q1235: Write me a generic Formatter of type T that captures a prefix variable from the enclosing scope and uses it inside the overridden format method.
- Q1380: How do I split my code across multiple .ek9 files in one project?
- Q1381: Can I put a guard on a stream 'for' pipeline?
- Q1980: What do <-, :=? and := each do in the head of an if, switch, for, while or try?