An internal build error has occurred (switch statement)

Whilst working today in Flex Builder we all did an update on SVN and all of a sudden we all had the same error…

Description:
An internal build error has occurred. Right-click for more information.

Location:
Unknown

So off we went trying to find the problem as there wasn’t any other info on the error. We trawled through all sorts of options including hidden files trying to hunt down the problem to no avail. Turns out if you create switch statement with no body in Flex Builder this unhelpful error is displayed. To re-create all you need to do is:

[as]switch( true )
{

}[/as]

I hope this helps others find the route of this error quicker than we did, and I’ve logged a bug here. Please go vote!

25 Responses to “An internal build error has occurred (switch statement)”

  1. Nice to know! Flex really does display some pretty cryptic error messages sometimes, but even worse is the compiler in Flash authoring.

  2. BobPardoe says:

    We raised this as an issue a number of months ago. It was raised & deferred \ closed ages before we even found it.

    I cant remember why it was closed however.

    Also this does not cause a problem in FB 2 running against 9.0.47 but does against 9.0.115

    BOb

  3. Glen says:

    I had a similar problem with this cr(y|a)ptic error message.

    I was trying to build a Flex SWF that was loaded into a Flash SWF – the Flash SWF was running in Test Movie when I tried to build in Flex.

    I had to close the SWF and restart Flex – that sucks because it takes soooo long to start when it decides to refresh my resource heavy project…

  4. We also had a similar problem. The culprit in our case was too many lines of code with no semi-colons at the end. Even though semi-colons are optional in AS, the Flex compiler was choking.

  5. I’ve also come across this – it was a nightmare to track down. In the end I found the empty switch being the cause. I believe I filed a bug at the time (Flex 3 beta) or at least reported it omn the beta list and was told it would not be fixed in time. I asked for it to be included in the release notes due to the time wasting nature of this problem which didn’t seem to have happened either… What more can one do? (yes – I should have blogged it…)

  6. daniele says:

    also, if you do a typo like:
    0.0.123
    the “internal build error” will come up, and you will spend an entire day sorting out the problem. grr

  7. Rob says:

    I currently have this problem on a project I have picked up. Worse still it’s come from Flex 2 and Im now in Flex 3!

    I found a lot of switch statements where the default had no code in it, but as of yet still have the problem. I am looking for if statements now :(

    Thing is it could be anything :’( Wish me luck

  8. Rob says:

    I have been through every switch statement in the project and there are none that don’t have a case statement. Some had empty case statements, or no default, but in a test that didn’t cause the same error along.

    I have also tried a really long line without a semi colon on the end in a test, but it seems fine.

    So now I am really lost… can anyone think of any other reasons this may happen? It was a flex builder 2 project until now, so may be something else related to moving to flex builder 3 perhaps.

  9. Rob says:

    I found it!

    It was a switch statement as you said, no idea why or how I missed it when searching through the project :(

    Thanks for the help Tink!

  10. Tink says:

    Glad you sorted it man!

    My apologies for being so quiet on this. Had some personal issues going on.

  11. Nathan says:

    It should be noted – this is just one of the (many it seems) reasons there could be an “internal build error”. My current one is an issue between a component created in Flash CS3 using the Flex Component Kit. No error in Flash however, just a conflict between the AS3 in Flash and compiling the component into Flex. Added a “this” to the front of calls to child components in the Flash component to fix.

  12. prashant shelke says:

    Heyyy !!!

    Thanks alot. This is superb & thanks alot. I was investing this by last 2 days!!!

    Just corrected & feeling coool.

    Thanks a lot.
    Prashant Shelke.

  13. Andrew says:

    In my case we are using modules in a main application. When I added a variable in a module, like this:
    private var tabBarData:XMLList = Application.application.menuData.mengroup.(@module == ‘admin’);

    The magical error message arrived. No solution yet..if I delete this statement and restart FLEX, all seem to be OK though…

  14. Danny Miller says:

    This only happens to me when I try running the application when it’s in debug mode and already running.

  15. Billigflug says:

    Well, just get the same error, now I know why. Sorry for beeing pragmatic, but I restored it. During the next week I´ll go to fix it. Thanks anyway.

  16. Iceline says:

    Although I cannot reproduce it with my current Flex Builder:
    Declaring variables in an interface also generated this specific error.

  17. esaund says:

    This line caused an internal build error:

    public var m_subcategory_y_offset:int = DocListIcon.ms_doclist_icon_height = m_subcategory_y_spacing;

    It was a bug because (hacking in the dark) the second equals sign was supposed to be a -.

  18. purpurina says:

    I got the same error msg but the cause was “invalid character” that Flex 3 doesn´t recognize and, for sure doesn´t show.
    I was able to detect this behaviour using another text editor like Notepad and then deleting this line.

  19. Nathan says:

    I get the same error from time to time when developing AIR applications. It seems to have something to do with the adl.exe process running (having to do with AIR). I can get rid of the error by stopping that process via Task manager and cleaning my project. If the adl.exe process is still running when I clean my project, it will still cause the error. The only other solution is to shut Flex Builder down and restart, then clean the project.

  20. Karfau says:

    Another source for this bloody error:
    I had a properties-file wich I created in ANSI format. it didn’t metter what I tried to change the format: the error stayed.

    The Message from the log:
    !MESSAGE Uncaught exception in compiler
    !STACK 0
    java.lang.StringIndexOutOfBoundsException: String index out of range: 1

    How I found out wich file it was:
    deleting/reverting with help of svn (this was such a bad time)

    My soloution:
    -Opening the file in editor
    -copy another prop-file paste it with the name of the broken file and
    -type everything from the editor (copy didn’t work for me) in the newly created file

  21. Thanks for this.
    Sometimes Flex displays really crazy error messages – it’s like the compiler of the Flash authoring.

  22. Jason Swick says:

    I ran into the same cryptic error, and tried the suggestions above to no avail. Finally, I reverted my mxml file to a previous repository version, then did a compare on against the latest repository file (the one getting the error) then tediously skipped to each difference, copying the diff line from the newer file to the older and saving / recompiling, waiting for the cryptic error again. Finally!:
    I have an HBox inline component defined in the code that implements IDropInListItemRenderer and in the new file I had removed the public function get listData():BaseListData, I had removed it from other inline components safely, but those (CheckBox, TextInput) naitively implement the IDropInListItemRenderer, so when I removed it from the HBox, flex cried.

  23. [...] Tink: An internal build error has occurred (switch statement) [...]

  24. Priyank says:

    This would be a cause

    [Event]

  25. Gaurav Joshi says:

    Hey Guys,

    It is absolutely dangerous error. I encountered when I missed the var keyword before the declared variable. I ended up in wasting half an hour.

    Please do take care to use “var” while declaring the variables.

    Happy Coding!

    Gaurav Joshi

Leave a Reply