Document won't save - cannot set property '$k' of undefined
Hello,
i had a document that won't save and now i get this error every time the cron job runs:
[documentserver_community] Error: OCA\DocumentServer\Document\DocumentConversionException: change_code: !0!==this.xz?this.Ua:this.ym[a]);if(!1!==e){var h=d.fa.splice(e,1);d.IW(h);AscCommon.Rd.H4(d,e,1);0<e?e<=d.fa.length-1?(d.fa[e-1].$k=d.fa[e],d.fa[e].pk=d.fa[e-1]):d.fa[e-1].$k=null:e<=d.fa.length-1&&(d.fa[e].pk=null);0<=e&&e<=d.fa.length-1&&(d.sh&&d.sh.Nma(e,1),d.j4(e))}}};ak.prototype.vR=function(d){return this.Oa!==d.Oa||AscDFH.aya!==d.ka&&AscDFH.bya!==d.ka?!1:!0};ak.prototype.Mm=function(){return this.DR(Fr)};kl.prototype=Object.create(AscDFH.nm.prototype);kl.prototype.constructor=kl;kl.prototype.ka=
change: Uncaught TypeError: Cannot set property '$k' of undefined
DoctRenderer:<result><error index="3790" /></result>
at <<closure>>
0. /var/www/html/nextcloud/apps/documentserver_community/lib/DocumentConverter.php line 123
OCA\DocumentServer\Document\ConverterBinary->run("/tmp/oc_tmp_wpPIBz-.xml", null)
1. /var/www/html/nextcloud/apps/documentserver_community/lib/DocumentConverter.php line 78
OCA\DocumentServer\DocumentConverter->runCommand(OCA\DocumentServ ... {})
2. /var/www/html/nextcloud/apps/documentserver_community/lib/Document/DocumentStore.php line 151
OCA\DocumentServer\DocumentConverter->saveChanges("*** sensitive parameter replaced ***", ["78;AgAAADEA//8 ... "], "/srv/nextcloud- ... t", "odt")
3. /var/www/html/nextcloud/apps/documentserver_community/lib/LocalAppData.php line 100
OCA\DocumentServer\Document\DocumentStore->OCA\DocumentServer\Document\{closure}("*** sensitive parameters replaced ***")
4. /var/www/html/nextcloud/apps/documentserver_community/lib/Document/DocumentStore.php line 164
OCA\DocumentServer\LocalAppData->getReadWriteLocalPath(OC\Files\SimpleFS\SimpleFolder {}, Closure {})
5. /var/www/html/nextcloud/apps/documentserver_community/lib/Document/SaveHandler.php line 56
OCA\DocumentServer\Document\DocumentStore->saveChanges(627642030, [OCA\DocumentSer ... }])
6. /var/www/html/nextcloud/apps/documentserver_community/lib/BackgroundJob/Cleanup.php line 69
OCA\DocumentServer\Document\SaveHandler->flushChanges(627642030)
7. /var/www/html/nextcloud/lib/public/BackgroundJob/Job.php line 79
OCA\DocumentServer\BackgroundJob\Cleanup->run(null)
8. /var/www/html/nextcloud/cron.php line 125
OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})
I can also reproduce this error with occ documentserver:flush
Any idea how i can remove the corrupted file? I tried reinstalling documentserver_community + ONLYOFFICE without success.
I removed the doc_xxxxxxxxxx folder in der nextcloud data\appdata_xxx \documentserver_community
Running occ documentserver:flush now works.
Same bug here.
This error is coming from the onlyoffice/sdkjs/word/Editor/DocumentChanges.js:340.
There are a few other spots where the error is possible. This was for the Load method specifically, but there are other methods that have very similar code that I didn't fix.
Apparently line 312:
var Pos = oDocument.m_oContentChanges.Check(AscCommon.contentchanges_Remove, true !== this.UseArray ? this.Pos : this.PosArray[nIndex]);
Pos can be greater than oDocument.Contents.length; Setting oDocument.Contents[Pos-1].Next = null will result in an error in these cases.
I was able to fix the issue by changing:
d.fa[a-1].$k=null
to
(d.fa[a-1]&&(d.fa[a-1].$k=null))
at apps/documentserver_community/3rdparty/onlyoffice/documentserver/sdkjs/word/sdk-all.js:7996.
After this change, everything appears to saving out correctly. This could obviously be a more complex, systemic issue within the sdkjs library. Definitely recommend forwarding the issue along to the ONLYOFFICE folk.
| Software | Version |
|---|---|
| NextCloud | 18.0.4 |
| Document Server | v0.1.5 |
| ONLYOFFICE | v4.1.4 |
YMMV.
Having the same problem when using images in the document. I can't open the document anymore.
Just had the same bug. I pressed a couple of times enter on a template and suddenly the page disappeared. Reloading did not work and the document opend in libreoffice was empty. I got this error:
[documentserver_community] Error: OCA\DocumentServer\Document\DocumentConversionException: change_code: a?this.Nb.splice(d+1,this.Nb[0]-d):this.Nb[0]!==d+1&&0!==a&&(this.Nb.splice(d+2,this.Nb[0]-d-1),this.Nb[0]=d+1)}0===a&&this.Nb[0]!==d+1&&(this.Nb.splice(d+1,0,this.Nb.length-d-1),this.Nb[0]=d+1);c=1+this.Nb[0]+this.Nb[d+1]+2*a;this.Nb[c+0]=0;this.Nb[c+1]=0;return 0!==d||0!==a?this.Nb[c-1]:0};nb.prototype.saa=function(d,a,c,e){d=this.lxb(d,a);this.Nb[d+0]=c;this.Nb[d+1]=e};nb.prototype.qYb=function(d,a,c){this.Nb[this.lxb(d,a)+1]=c};nb.prototype.BG=function(){this.bb&&(this.bb.ey.b8d(),this.bb.kd.Z7a(Kl))};
change: Uncaught TypeError: Cannot read property 'b8d' of undefined
DoctRenderer:
I removed the
doc_xxxxxxxxxxfolder in dernextcloud data\appdata_xxx \documentserver_communityRunning
occ documentserver:flushnow works.
This also worked for me, but for me the error message was about the document Server only Supporting 20 People.