I confirmed LocationID and Check.Weight is set correctly. But when I run it in this CFC…
<cffunction name="GetCharacterEncumbrance" hint="Returns Encumbrance of the Character" returntype="String">
<cfargument name="CharacterID" Required=True>
<cfargument name="AdditionalWeight" Required=False default="0">
<cfset Encumbrance = 0>
<cfset LEVEL = 0>
<cfquery name="CharacterInfo">
Select Characters.ST + IFNULL((Select Sum(ST) as total from Character_Drugs where CharacterID = #CharacterID# and Active = 1),0) as ST
, HP
, PlanetID
From Characters
Where CharacterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#CharacterID#">
</cfquery>
<cfquery name="CharacterWeight">
Select IFNULL(Sum(Weight),0) as TotalWeight
from Items_Active
Where LocationID = #CharacterID#
and LocationType = 'Character'
</cfquery>
<cfset Weight = CharacterWeight.TotalWeight + AdditionalWeight>
It stops at the end with the error
Error: variable [LEVEL] doesn’t exist
Line: 647 (the last line shown).
I even put in a cfset at the top, but I still get it (I got it when it wasn’t there as well). I tried removing additionalweight and then it did the same thing on the same line.
I can’t even dump out the variables because it tells me level doesn’t exist.
Even when I did a , right above setting encumbrance, it STILL gives me the level error on that line.
Select Characters.ST + IFNULL((Select Sum(ST) as total from
Character_Drugs where CharacterID = #CharacterID# and Active = 1),0)
as ST
, HP
, PlanetID
From Characters
Where CharacterID =
Select IFNULL(Sum(Weight),0) as TotalWeight
from Items_Active
Where LocationID = #CharacterID#
and LocationType = 'Character'
yeah we really need the stacktrace, the exception for sure not happen on the last line of the code posted, there is no “level” on that line …
What i see in your code that you have not properly scoped the variables defined inside the function (including the query objects) what easly could cause problems like this. There are 2 ways to solve this.
do everywhere local. in front of the variable name
Catch
Entries: 13
additional
Struct (ordered)
cause
Struct
additional
Struct (ordered)
Detail
string
ErrNumber
number 0
ErrorCode
string 0
Extended_Info
string
ExtendedInfo
string
Message
string variable [LEVEL] doesn’t exist
StackTrace
string lucee.runtime.exp.ExpressionException: variable [LEVEL] doesn’t
exist at
lucee.runtime.type.scope.UndefinedImpl.getCollection(UndefinedImpl.java:422)
at
__138.data.projectelpis.cfc.character_cfc$cf.udfCall1(…/Data/ProjectElpis/cfc/Character.cfc:648)
at
__138.data.projectelpis.cfc.character_cfc$cf.udfCall(…/Data/ProjectElpis/cfc/Character.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at
lucee.runtime.type.UDFImpl._call(UDFImpl.java:338) at
lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:211) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:663) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at
lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1931) at
lucee.runtime.tag.Invoke.doComponent(Invoke.java:221) at
lucee.runtime.tag.Invoke.doEndTag(Invoke.java:194) at
__138.data.projectelpis.cfc.inventory_cfc$cf.udfCall(…/Data/ProjectElpis/cfc/Inventory.cfc:436)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at
lucee.runtime.type.UDFImpl._call(UDFImpl.java:338) at
lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:211) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:663) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at
lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1931) at
lucee.runtime.tag.Invoke.doComponent(Invoke.java:221) at
lucee.runtime.tag.Invoke.doEndTag(Invoke.java:194) at
__138.data.projectelpis.circuits.business.chat.__138.__138.generaluse.act_take_cfm$cf.call(…/Data/ProjectElpis/Circuits/Business/Chat/…/…/GeneralUse/act_Take.cfm:7)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:893) at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:838) at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:822) at
__138.data.projectelpis.parsed.chat_take_cfm230$cf.call(…/Data/ProjectElpis/parsed/chat.take.cfm:68)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:893) at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:838) at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:822) at
__138.data.projectelpis.application_cfc$cf.udfCall1(…/Data/ProjectElpis/Application.cfc:228)
at
__138.data.projectelpis.application_cfc$cf.udfCall(…/Data/ProjectElpis/Application.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at
lucee.runtime.type.UDFImpl._call(UDFImpl.java:338) at
lucee.runtime.type.UDFImpl.call(UDFImpl.java:225) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:662) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at
lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at
lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:755)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1697) at
__138.data.projectelpis.fusebox5_cfm$cf.call(…/Data/ProjectElpis/fusebox5.cfm:57)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:893) at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:838) at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:822) at
index_cfm$cf.call(/index.cfm:48) at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:893) at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:838) at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:822) at
application_cfc$cf.udfCall(/Application.cfc:131) at
lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at
lucee.runtime.type.UDFImpl._call(UDFImpl.java:338) at
lucee.runtime.type.UDFImpl.call(UDFImpl.java:225) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:662) at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at
lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at
lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:422)
at
lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:224)
at
lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:43)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2394) at
lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2385) at
lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2353) at
lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:917) at
lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:102)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
TagContext
Array
1
Struct
codePrintHTML
string 646: </cfquery> 647: 648: <cfset Weight =
CharacterWeight.TotalWeight + AdditionalWeight> 649: 650:
<cfinvoke component="Planets"
method="GetPlanetGravity"
returnvariable="Gravity">
codePrintPlain
string 646: 647: 648: <cfset Weight =
CharacterWeight.TotalWeight + AdditionalWeight> 649: 650:
column
number 0
id
string ??
line
number 648
Raw_Trace
string
__138.data.projectelpis.cfc.character_cfc$cf.udfCall1(…/Data/ProjectElpis/cfc/Character.cfc:648)
template
string
/opt/lucee/tomcat/webapps/ROOT/Ubersite/Data/ProjectElpis/cfc/Character.cfc
type
string cfml
2
Struct
codePrintHTML
string 434: <cfinvokeargument name="CharacterID"
value="#LocationID#"> 435: <cfinvokeargument
name="AdditionalWeight" value="#Check.Weight#">
69: <cfcatch type="missingInclude"><cfif
len(cfcatch.MissingFileName) gte 29 and right(cfcatch.MissingFileName,29)
is "…/…/GeneralUse/act_Take.cfm"> 70: <cfthrow
type="fusebox.missingFuse" message="missing Fuse"
detail="You tried to include a fuse …/…/GeneralUse/act_Take.cfm in
circuit Chat which does not exist (from fuseaction Chat.Take).">
codePrintPlain
string 66: 67: 68:
69: <cfif len(cfcatch.MissingFileName) gte
29 and right(cfcatch.MissingFileName,29) is
“…/…/GeneralUse/act_Take.cfm”> 70:
column
number 0
id
string ??
line
number 68
Raw_Trace
string
__138.data.projectelpis.parsed.chat_take_cfm230$cf.call(…/Data/ProjectElpis/parsed/chat.take.cfm:68)
template
string
/opt/lucee/tomcat/webapps/ROOT/Ubersite/Data/ProjectElpis/parsed/chat.take.cfm
type
string cfml
5
Struct
codePrintHTML
string 226: —> 227: <cflock
name="#_parsedFileData.lockName#" type="readonly"
timeout="30"> 228: <cfinclude
template="#_parsedFileData.parsedFile#" /> 229:
</cflock> 230: <cfcatch type="missinginclude">
codePrintPlain
string 226: —> 227: 228: 229: 230:
column
number 0
id
string ??
line
number 228
Raw_Trace
string
__138.data.projectelpis.application_cfc$cf.udfCall1(…/Data/ProjectElpis/Application.cfc:228)
template
string
/opt/lucee/tomcat/webapps/ROOT/Ubersite/Data/ProjectElpis/Application.cfc
type
string cfml
6
Struct
codePrintHTML
string 55: </cftry><cfprocessingdirective
suppresswhitespace="true"> 56: <cftry> 57:
<cfset __fuseboxAppCfc.onRequest(CGI.SCRIPT_NAME) /> 58:
<cfset __fuseboxAppCfc.onRequestEnd(CGI.SCRIPT_NAME) /> 59:
<cfcatch type="any">
The odd thing is that I have the save version of Lucee 5.1.18 on my windows
system and my production which is Ubuntu. It works fine on windows, but not
on Ubuntu. I think this may be some kind of bug with Lucee itself.
I’m guessing (because that’s all I can do with the little information that we have), that an older version of the script is cached on the server, and it references a missing variable named LEVEL.
Because of that “caching”, the error message is not in sync with the source snippet that you posted.