# Suspected bug as ST writes config file, introduces spurious newline & indent

**URL:** https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148
**Category:** Support
**Created:** [September 25, 2026, 5:10pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148 "2026-09-25T17:10:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JimH44](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@JimH44](https://forum.syncthing.net/u/JimH44)
#### Post date: [September 25, 2026, 5:10pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/1 "2026-09-25T17:10:14Z")

</div>

Hello,

A problem has just surfaced with 2.5.1 on Windows 11. Gemini thinks it comes from the way the Go code that ST uses processes what is being written to config.xml. They also said I should ask the User Forum before I lodge an Issue.

The crippler is that the config file ends up with lines like this in it: It seems that an empty field gets split over two lines ( is HTML code for a newline character). Then the server is trying to send files unencrypted but the client is expecting them to come encrypted and these don’t match, so no transfer happens.

I have a markdown file with all the details, ready to submit as an issue, if you think that would be appropriate.

Thanks for thinking about this, Jim

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [September 25, 2026, 5:37pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/2 "2026-09-25T17:37:58Z")

</div>

With all due respect, what you’ve written above doesn’t make much sense… 😕

Is there an actual issue that you’re experiencing? If yes, then screenshots showing the problem at hand would be very welcome.

---

<div class="post-metadata">

### Author: ![JimH44](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@JimH44](https://forum.syncthing.net/u/JimH44)
#### Post date: [September 25, 2026, 8:34pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/3 "2026-09-25T20:34:13Z")

</div>

Thanks @tomasz86 , for your reply.

No, it doesn’t make sense, because the display here interprets the HTML-encoded newline character, and I don’t know how to preview the post before sending. Let’s see if this shows what I meant everyone to see:

The crippler is that the config file ends up with lines like this in it: `<encryptionPassword>&#xA; </encryptionPassword>` It seems that an empty field gets split over two lines (`& # xA ;` `&#xA;` is HTML code for a newline character).

I do have a screenshot, and I’ll use the upload button to attach it.

 ![ST error, different encryption expectations](https://forum-uploads.syncthingcdn.net/original/3X/3/4/34263aaed6a928f992c4307b43c6ece0cf2c38fc.jpeg)

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [September 25, 2026, 9:36pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/4 "2026-09-25T21:36:29Z")

</div>

Thanks for the additional information. Syncthing itself doesn’t modify those fields without user input, however I’d suggest checking your browser and possibly password manager extensions (if you have any installed) that are most likely to touch them. We’ve had cases like that in the past. You may also want to check what happens when using a different browser.

At this point, you should probably shut Syncthing down, manually change the modified lines in `config.xml` to just `<encryptionPassword></encryptionPassword>`, and then restart the application.

---

<div class="post-metadata">

### Author: ![JimH44](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@JimH44](https://forum.syncthing.net/u/JimH44)
#### Post date: [September 25, 2026, 10:07pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/5 "2026-09-25T22:07:35Z")

</div>

Thanks, @tomasz86 , the test computer is not using any password manager, and we have already shut SyncThing down, removed the code for newline and indentation and restarted SyncThing.

When our script runs again, and SyncThing obeys our POST commands, the problem returns. And our POST commands said nothing about encryptionPassword.

I’ll upload a markdown file that contains more details.

[syncthing-bug-report-on-newline-passwords.md](https://forum.syncthing.net/uploads/short-url/mrr0cFyYaAxNVuYD7tcdKztiidt.md) (3.9 KB)

---

<div class="post-metadata">

### Author: ![JimH44](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@JimH44](https://forum.syncthing.net/u/JimH44)
#### Post date: [September 30, 2026, 12:00pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/6 "2026-09-30T12:00:16Z")

</div>

It turns out that this problem was caused by our Power Shell script even before it started Syncthing.

So Syncthing is not at fault – sorry for blaming this great software.

Here’s what really caused it.

Our Power Shell script was doing:

`[xml]$xml = Get-Content -Path $path`

and

`$xml.Save($path)`

These calls used the .NET Framework that Power Shell runs on, with the effect that the original `<encryptionPassword></encryptionPassword>` was turned into ` <encryptionPassword>`` </encryptionPassword>`

When. Syncthing finally saw that, it regarded the newline character and some spaces as the password, producing this `<encryptionPassword>&#xA; </encryptionPassword>` which didn’t match the unencrypted transfer expected by the partner machine.

So, sorry Syncthing, I misjudged you.

---

<div class="post-metadata">

### Author: ![acolomb](https://forum.syncthing.net/user_avatar/forum.syncthing.net/acolomb/32/11343_2.png) [@acolomb](https://forum.syncthing.net/u/acolomb)
#### Post date: [October 1, 2026, 9:50pm UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/7 "2026-10-01T21:50:50Z")

</div>

Isn’t whitespace in XML something that must be ignored though, as per the language specification? Or, at least collapsed into a single whitespace character upon reading. If we do want to store arbitrary characters in there verbatim, including newlines, it should maybe use `<![CDATA[MyCrazyPassword]]>` in there?

The alternative is entity-escaping the special characters. Which hopefully the Go XML encoder does.

But on reading, unescaped whitespace inside an element’s text content can be reduced to a single space per span, stripping leading and trailing spaces altogether.

I’m surprised that this apparently does not happen when unmarshaling the XML in Go. Are we missing some struct flag maybe?

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [October 2, 2026, 5:26am UTC](https://forum.syncthing.net/t/suspected-bug-as-st-writes-config-file-introduces-spurious-newline-indent/27148/8 "2026-10-02T05:26:50Z")

</div>

As far as I understand it, whitespace between elements is ignored (e.g., indentation), but whitespace within a text element is significant. Unfortunately for something like an external writer/formatter it’s impossible to distinguish between the two when there’s no text content yet and there’s no DTD to specify…
