Help with error: "unable to load /path/file.xml"

nasuellia

Warlord
Joined
Sep 29, 2010
Messages
130
Hello there, I'm new to the modding scene for Civ and I'm stumbling on an issue.
I'm making a small mod that plays with the overlays in the building placement UI, and the JavaScript changes I made are working perfectly fine.
I also need to change a single row in: text/en_us/UIText.xml
And that is where I am getting stuck, here's the relevant bit of log from the modloader (in bold the part about the <UpdateText> action that is failing):

[2025-02-18 23:22:29] betterbuildingplacementui-scripts (ImportFiles)
[2025-02-18 23:22:29] Loading base-standard/ui/interface-modes/interface-mode-place-building.js
[2025-02-18 23:22:29] Loading core/ui/utilities/utilities-core-textprovider.js
[2025-02-18 23:22:29] betterbuildingplacementui-text (UpdateText)
[2025-02-18 23:22:29] Creating database save point.
[2025-02-18 23:22:29] Loading text/en_us/UIText.xml
[2025-02-18 23:22:29] Error: Unable to open C:/Users/<mywindowsusername>/AppData/Local/Firaxis Games/Sid Meier's Civilization VII/Mods/BetterBuildingPlacementUi/text/en_us/UIText.xml
[2025-02-18 23:22:29] Successfully released save point.

And here is the relevant bit of my modinfo:
XML:
    <ActionCriteria>
        <Criteria id="always">
            <AlwaysMet/>
        </Criteria>
        <Criteria id="any-age" any="true">
            <AgeInUse>AGE_ANTIQUITY</AgeInUse>
            <AgeInUse>AGE_EXPLORATION</AgeInUse>
            <AgeInUse>AGE_MODERN</AgeInUse>
        </Criteria>
    </ActionCriteria>
    <ActionGroups>
        <ActionGroup id="betterbuildingplacementui-scripts" scope="game" criteria="any-age">
            <Actions>
                <ImportFiles>
                    <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
                    <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
                </ImportFiles>
            </Actions>
        </ActionGroup>
        <ActionGroup id="betterbuildingplacementui-text" scope="game" criteria="any-age">
            <Actions>
                <UpdateText>
                    <Item>text/en_us/UIText.xml</Item>
                </UpdateText>
            </Actions>
        </ActionGroup>
    </ActionGroups>

I'm sure some experienced modder will easily spot some silly mistake. In that case, thanks a lot in advance!
PS: in the snippet above I'm using that weird any-age criteria as part of my attempts to fix this, I started with the usual "always" criteria and had the same issue.
 
That log is saying the modinfo is being parsed just fine, and it triggers the text database update. The problem is with the text XML file - it's either not there or most likely it happens to have a mistake. Post that file if you can't spot the mistake?
 
Check the UI.log as that might have some more info but other than that yeah, the xml file has an error and the game can't compile.
 
First of all thanks for the reply to both of you!
In regards to the UI.log file, I couldn't find anything relevant.

Here's my UIText.xml file:

XML:
<?xml version="1.0" encoding="utf-8"?>
<Database>
    <EnglishText>
        <Replace Tag="LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS">
            <Text>+{1_Amount} {2_YieldName} for each adjacent Quarter</Text>
        </Replace>
    </EnglishText>
</Database>

The file is there, in fact I will list the places in which I tried putting it (not sure which one would be the correct folder structure but the error is the same for either path).

│ BetterBuildingPlacementUi.modinfo

├───base-standard
│ ├───text
│ │ └───en-us
│ │ UIText.xml
│ │
│ └───ui
│ └───interface-modes
│ interface-mode-place-building.js

├───core
│ └───ui
│ └───utilities
│ utilities-core-textprovider.js

└───text
└───en-us
UIText.xml
 
Last edited:
I'm not quite sure as it looks fine to me. Not really an expert on the ui or xml in general but from searching how they do text replacement in the base game xmls I suggest you try this. It seems like you might have to delete and then redefine the Tag. Honestly, not sure on this one. I don't believe the location matters as long as it matches what you put in .modinfo file. base-standard -> text -> en-us -> UIText.xml = <Item>base-standard/text/en_us/UIText.xml</Item> || text -> en-us -> UIText.xml = <Item>text/en_us/UIText.xml</Item>



<?xml version="1.0" encoding="utf-8"?>
<Database>
<!-- Delete existing strings/translations for the given keys.-->
<LocalizedText>
<Delete Tag="LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS" />
</LocalizedText>

<!-- Define platform-specific overrides. -->
<EnglishText>
<Row Tag="LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS_LOCAL">
<Text>+{1_Amount} {2_YieldName} for each adjacent Quarter</Text>
</Row>

<Replace Tag="LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS">
<Text>{LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS_LOCAL}</Text>
</Replace>
</EnglishText>
</Database>
 
Last edited:
I assume you are still pulling those two values from the .js file? Did you make sure the values for Amount and YieldName are valid and defined? If you remove {1_Amount} {2_YieldName}, does it load?
 
Tried with a simple text with no weird syntax:

XML:
<?xml version="1.0" encoding="utf-8"?>
<Database>
    <EnglishText>
        <Replace Tag="LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS">
            <Text>Test</Text>
        </Replace>
    </EnglishText>
</Database>

Same error, as if the file wasn't there. "unable to read"
 
Either, betterbuildingplacementui-text needs to be scoped to shell or it's a Windows file permission error. That's all I can think of because I threw it into a test mod and it works in my game. Sorry I couldn't be more help!

<ActionGroup id="betterbuildingplacementui-text" scope="shell" criteria="any-age">
 
Last edited:
Either, betterbuildingplacementui-text needs to be scoped to shell or it's a Windows file permission error. That's all I can think of because I threw it into a test mod and it works in my game. Sorry I couldn't be more help!

<ActionGroup id="betterbuildingplacementui-text" scope="shell" criteria="any-age">
I already tried scoping it for "shell" instead of "game", as far as I understand that's for main-menu stuff that has no "age" or "game" going on yet so I don't think it matters in this case. Anyway I tried before already and gave the same result.
The windows permission issue is also bizarre because the other files (the js) are basically in the same root path and are accessible just fine.
This is so weird.
Thanks a lot for the help mate. Let's see if someone else comes up with another idea.
 
Yeah the scope just controls when it's loaded. It should be fine to load it on game but it was worth a shot.
 
Oh by the way, would you be a lamb and paste here the .modinfo you used for the test, if possible? I can give it a try, maybe the issue is somewhere else in my modinfo, strangely enough.
 
XML:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="test" version="1"
        xmlns="ModInfo">
        <Properties>
                <Name>LOC_MODULE_TEST</Name>
                <Description>LOC_MODULE_TEST_DESC</Description>
                <Authors>Ian Moon</Authors>
                <ShowInBrowser>1</ShowInBrowser>
                <Package>Test</Package>
        </Properties>
        <Dependencies>
                <Mod id="core" title="LOC_MODULE_CORE_NAME"/>
                <Mod id="base-standard" title="LOC_MODULE_BASE_STANDARD_NAME"/>
                <Mod id="age-antiquity" title="LOC_MODULE_AGE_ANTIQUITY_NAME"/>
                <Mod id="age-exploration" title="LOC_MODULE_AGE_EXPLORATION_NAME"/>
                <Mod id="age-modern" title="LOC_MODULE_AGE_MODERN_NAME"/>
        </Dependencies>
        <ActionCriteria>
                <Criteria id="always">
                        <AlwaysMet/>
                </Criteria>
        </ActionCriteria>
        <ActionGroups>
                <!-- Shell -->
                <ActionGroup id="myTest" scope="game" criteria="always">
                        <Actions>
                                <UpdateText>
                                        <Item>text/en_us/UIText.xml</Item>
                                </UpdateText>
                        </Actions>
                </ActionGroup>
        </ActionGroups>
        <LocalizedText>
                <File>text/en_us/ModuleText.xml</File>
        </LocalizedText>
</Mod>

...
[2025-02-19 01:56:02] myTest (UpdateText)
[2025-02-19 01:56:02] Creating database save point.
[2025-02-19 01:56:02] Loading text/en_us/UIText.xml
[2025-02-19 01:56:02] Successfully released save point.
[2025-02-19 01:56:02] core-shell-victory-settings (UpdateDatabase)
...

XML:
<?xml version="1.0" encoding="utf-8"?>
<Database>
    <EnglishText>
        <Replace Tag="LOC_UI_ADJACENCY_INFO_UNIQUE_QUARTERS">
            <Text>Your Text Goes Here</Text>
        </Replace>
    </EnglishText>
</Database>

text/en_us/ModuleText.xml :

XML:
<?xml version="1.0" encoding="utf-8"?>
<Database>
        <EnglishText>
                <Row Tag="LOC_MODULE_TEST">
                        <Text>A Test</Text>
                </Row>
                <Row Tag="LOC_MODULE_TEST_DESC">
                        <Text>Just a test.</Text>
                </Row>
        </EnglishText>
</Database>
**********************************************************************************
Is it maybe that you need the dependency on core and base-standard? I think that might be it. The dependency should pull in the file structure as a parent to your file. If you aren't doing that it could be why the game can't find the file.....maybe? lol Nope.
 
Last edited:
Wait wait, with your modinfo there is, in fact, no error in the log. The only difference I can spot between yours and mine, is that you have dependencies for all ages in addition to base and core, while I didn't have those.
The weird thing is that if I add those dependencies, my javascript files stop being imported instead. (I see no errors but they just don't even show up in the modloader). I am clearly misunderstanding something big here.

My full .modinfo
XML:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="betterbuildingplacementui" version="1" xmlns="ModInfo">
    <Properties>
        <Name>Better Building Placement UI</Name>
        <Description>WIP</Description>
        <Authors>Nasu</Authors>
        <Package>Mod</Package>
        <AffectsSavedGames>0</AffectsSavedGames>
    </Properties>
    <Dependencies>
        <Mod id="base-standard" title="LOC_MODULE_BASE_STANDARD_NAME"/>
        <Mod id="core" title="LOC_MODULE_CORE_NAME"/>
    </Dependencies>
    <ActionCriteria>
        <Criteria id="always">
            <AlwaysMet/>
        </Criteria>
    </ActionCriteria>
    <ActionGroups>
        <ActionGroup id="betterbuildingplacementui-scripts" scope="game" criteria="always">
            <Actions>
                <ImportFiles>
                    <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
                    <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
                </ImportFiles>
            </Actions>
        </ActionGroup>
        <ActionGroup id="betterbuildingplacementui-text" scope="game" criteria="always">
            <Actions>
                <UpdateText>
                    <Item>base-standard/text/en_us/UIText.xml</Item>
                </UpdateText>
            </Actions>
        </ActionGroup>
    </ActionGroups>
</Mod>

With this .modinfo, my mod (the js files) loads perfectly fine, both the script in core and the one in base-standard (of course those files are in the same paths as specified in the ImportFiles action) but I get the error loading the UpdateText. I also tried the UpdateText pointing directly to text/en_us/UIText.xml (where I have a copy of the file), with the same result.

If I add the three dependencies, the opposite happens, no more error for UIText.xml, but the scripts do not load at all. Here's the same exact modinfo with the added dependencies:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="betterbuildingplacementui" version="1" xmlns="ModInfo">
    <Properties>
        <Name>Better Building Placement UI</Name>
        <Description>WIP</Description>
        <Authors>Nasu</Authors>
        <Package>Mod</Package>
        <AffectsSavedGames>0</AffectsSavedGames>
    </Properties>
    <Dependencies>
        <Mod id="age-antiquity" title="LOC_MODULE_AGE_ANTIQUITY_NAME"/>
        <Mod id="age-exploration" title="LOC_MODULE_AGE_EXPLORATION_NAME"/>
        <Mod id="age-modern" title="LOC_MODULE_AGE_MODERN_NAME"/>
        <Mod id="base-standard" title="LOC_MODULE_BASE_STANDARD_NAME"/>
        <Mod id="core" title="LOC_MODULE_CORE_NAME"/>
    </Dependencies>
    <ActionCriteria>
        <Criteria id="always">
            <AlwaysMet/>
        </Criteria>
    </ActionCriteria>
    <ActionGroups>
        <ActionGroup id="betterbuildingplacementui-scripts" scope="game" criteria="always">
            <Actions>
                <ImportFiles>
                    <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
                    <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
                </ImportFiles>
            </Actions>
        </ActionGroup>
        <ActionGroup id="betterbuildingplacementui-text" scope="game" criteria="always">
            <Actions>
                <UpdateText>
                    <Item>base-standard/text/en_us/UIText.xml</Item>
                </UpdateText>
            </Actions>
        </ActionGroup>
    </ActionGroups>
</Mod>

I am supremely confused, I might be misunderstanding something fundamental here.
 
I'm really not sure. I thought it was the dependancies at first but when I remove them my game loads the files just fine. (I added blank js files just to test.)

XML:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="test" version="1"
        xmlns="ModInfo">
        <Properties>
                <Name>LOC_MODULE_TEST</Name>
                <Description>LOC_MODULE_TEST_DESC</Description>
                <Authors>Ian Moon</Authors>
                <ShowInBrowser>1</ShowInBrowser>
                <Package>Test</Package>
        </Properties>
        <ActionCriteria>
                <Criteria id="always">
                        <AlwaysMet/>
                </Criteria>
        </ActionCriteria>
        <ActionGroups>
                <ActionGroup id="myOtherTest" scope="shell" criteria="always">
                        <Actions>
                                <ImportFiles>
                                        <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
                                        <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
                                </ImportFiles>
                        </Actions>
                </ActionGroup>
                <ActionGroup id="myTest" scope="shell" criteria="always">
                        <Actions>
                                <UpdateText>
                                        <Item>text/en_us/UIText.xml</Item>
                                </UpdateText>
                        </Actions>
                </ActionGroup>
        </ActionGroups>
        <LocalizedText>
                <File>text/en_us/ModuleText.xml</File>
        </LocalizedText>
</Mod>

[2025-02-19 02:35:33] Loading ui/utilities/utilities-online.js
[2025-02-19 02:35:33] myOtherTest (ImportFiles)
[2025-02-19 02:35:33] Loading base-standard/ui/interface-modes/interface-mode-place-building.js
[2025-02-19 02:35:33] Loading core/ui/utilities/utilities-core-textprovider.js
[2025-02-19 02:35:33] myTest (UpdateText)
[2025-02-19 02:35:33] Creating database save point.
[2025-02-19 02:35:33] Loading text/en_us/UIText.xml
[2025-02-19 02:35:33] Successfully released save point.
 
Maybe using the modinfo where the scripts don't load. Start a game then check the Scripting log? Any errors? What happens if you smush them together?

XML:
<ActionGroup id="betterbuildingplacementui-scripts" scope="game" criteria="always">
            <Actions>
                <ImportFiles>
                    <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
                    <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
                </ImportFiles>
                <UpdateText>
                    <Item>base-standard/text/en_us/UIText.xml</Item>
                </UpdateText>
            </Actions>
</ActionGroup>
 
Last edited:
Wow... I wasted so much of your time mate...
I am the most utter moron on the effing planet.
Look at the directory tree I posted a few messages above...
there was simply a typo in the folder structure...
en-us instead of en_us
The most obvious thing imaginabile, and I missed it for 24 hours straight.
 
So I looked into base-standard.modinfo and the file interface-mode-place-building.js isn't under ImportFiles but instead it's under UIScripts. Maybe that's it?

XML:
<UIScripts>
    <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
    <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
</UIScripts>

_____________________________________________________________

Well, that will do it! Hahaha, it's always something small like that. Happens to me all the time, no worries! I'm glad you got it fixed, happy modding!
 
Last edited:
So I looked into base-standard.modinfo and the file interface-mode-place-building.js isn't under ImportFiles but instead it's under UIScripts. Maybe that's it?

XML:
<UIScripts>
    <Item>base-standard/ui/interface-modes/interface-mode-place-building.js</Item>
    <Item>core/ui/utilities/utilities-core-textprovider.js</Item>
</UIScripts>
No no, I found the issue... see my previous comment.
Everything works just fine now... it was the stupidest typo...
Thanks a whole bunch for all the help, seriously, and sorry for the time wasted!
 
Back
Top Bottom