Titanium JIRA Archive
Alloy (ALOY)

[ALOY-880] Improve error reporting on duplicate alloy controller id

GitHub Issuen/a
Resolution Date2014-02-10T20:29:13.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 03
Labelsalloy, controller, error
ReporterLee Driscoll
AssigneeTim Poulsen


Hi =] I had the following structure (note the duplicated id: 'scheduler'): index.xml
		<Tab title="Scheduler">
			<Require src="scheduler" id="scheduler" />
		<Tab title="Job List">
			<Require src="jobList" id="jobList" />
	<Window title="Scheduler" navBarHidden="false" layout="vertical">
		<Widget src="uk.co.ibcos.scheduler" dataProvider="jobData" id="scheduler" />
The error I received back came from alloy/controllers/BaseController.js line 36 : "cannot read property '__iamalloy' of undefined" The problem was that the duplicate id prevented one of the scheduler controllers to have an undefined value as it's 'parent' property. A check should occur somewhere sooner to warn that a duplicate id has been defined.


  1. Tim Poulsen 2014-02-10

    [~lsdriscoll] There is actually a warning message output. It's probably just that there's a lot of build messages that go by so that it's easy to miss it.
       [INFO]  [joblist.xml] view processing...
       [INFO]    view:       "joblist.xml"
       [WARN]  <Label> at line 3 is using this view's default ID "joblist". Only a top-level element in a view should use the default ID
    I used a label instead of a widget in my test app. Hence, I wouldn't get the same code error you saw. Instead, for me the label simply doesn't appear. Either way, the root cause is the same -- the child element is using the parent Window's id (which is assigned an id based on the file name since one isn't explicitly specified). I'm closing this as invalid. Reopen this ticket if you think I'm wrong in that assessment.
  2. Eric Merriman 2018-03-07

    Closing as invalid. If this is incorrect, please reopen.

JSON Source