fix: declare missing param in native console.error shim - #67
Open
moodyjmz wants to merge 1 commit into
Open
Conversation
moodyjmz
requested review from
j-base64 and
rikled
and removed request for
a team
July 31, 2026 10:24
The native console shim's error() referenced `param` without declaring it as a parameter, so every console.error() call inside the DoctRenderer JS context threw `ReferenceError: param is not defined`. Dormant until sendClientLog() started routing error-level messages through console.error(), after which any converter operation that logged an error aborted instead: DoctRenderer returned <error code="save"/> and exited 86. On the forced-save path that meant silent data loss, with the original error destroyed by the throw. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
moodyjmz
force-pushed
the
fix/native-console-error-missing-param
branch
from
July 31, 2026 10:31
cba19ab to
ca82f54
Compare
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
common/Native/native.js'sconsoleshim declareserrorwith no parameter but its body referencesparam:paramexists only as a formal parameter of the siblinglog/time/timeEndfunctions, so everyconsole.error()call in the DoctRenderer JS context throwsReferenceError: param is not defined. (Reading an undeclared identifier throws regardless of strict mode; only assignment differs.)Why it matters
native.jsis the first<file>entry inDocumentServer:build/configs/core/DoctRenderer.config, parsed intom_arrFilesbycore:DesktopEditor/doctrenderer/config.h:117-140and concatenated ahead ofsdk-all.jsbycore:DesktopEditor/doctrenderer/editors.cpp:69-75. It is therefore live in every converter operation — word, cell, slide, visio, pdf.The defect was dormant until
sendClientLog()began routing error-level messages throughconsole.error(). After that, any converter operation that logged an error threw instead of logging: DoctRenderer returns<result><error code="save" /></result>and exits 86. On the forced-save path that is silent data loss — the client reports "All changes saved" while nothing persists — and the original error is destroyed by the throw, so the logs say nothing useful about the actual fault.Because it is a deterministic code bug rather than a race, the same
docIdfails on every retry.The stack in the linked report matches this line byte-exactly: the deployed
common/Native/native.jsis 23 lines, andparamsits at column 318 of line 23 —<anonymous>:23:318.Blast radius
Not limited to spreadsheet co-editing, which is merely where it was first observed. DoctRenderer-reachable
console.error(call sites include:cell/apiBuilder.js:29161,word/apiBuilder.js:31653— Document Builder APIcommon/macros.js:102,123,502— macro executioncommon/apiBase.js:384pdf/build/api.js:188sendClientLog("error", …)callers likewise spanword/Editor/History.js:1024,slide/api.js,common/apiBase.js:362,1722andcell/.The fix
Declare the parameter. Deliberately the minimal change, matching the obvious upstream fix character-for-character so the eventual ONLYOFFICE sync merges cleanly —
common/Native/native.jshas seen 121 commits ever versus 1207 forcommon/editorscommon.js, and this is not a file worth diverging in.Alternatives considered and rejected:
try/catcharound theconsole.error(msg)call insendClientLog— fixes one of ~17 call sites, leaves the defect in place, and puts the divergence in a heavily-churned file. Maximum future conflict, minimum coverage.common/clipboard_base.js:1124,common/serviceworker/document_editor_service_worker.js:184,305), but they silently drop the second rather than throwing. Worth a separate follow-up, not worth bundling here.Testing
Nothing in
tests/runAll.jsorcheck-build.ymlexercises the DoctRenderer bundle — those run browser QUnit vianode-qunit-puppeteer, whereconsole.erroris the real platform function and this defect is unreachable by construction. That asymmetry is precisely why the bug shipped.Building a native-path harness is not proportionate to a one-word fix. The proportionate guard is
no-undef, which.eslintrc.yamldoes not currently enable and which nothing wires into the build; running eslint with only that rule overcommon/Native/*.jsflags this line and nothing else of substance. Follow-up PR to enable it and add it to thecode-stylegate is coming separately.Verification for this PR:
workflow_dispatchonDocumentServer'sbuild.ymlwithsdkjs_branchset to this branch, then confirm line 23 of the deployednative.jsin the built image.Related
Reported downstream as Euro-Office/DocumentServer#307 (deliberately a cross-reference, not a closing keyword — GitHub closing keywords do not act across repositories, and that issue should stay open until an image actually ships this).
Upstream: ONLYOFFICE/DocumentServer#3711 —
confirmed-bug+fixed-release, but still open, and no public ONLYOFFICE branch has any commit after 2026-05-26, so there is no upstream fix available to pull. Maintainer estimate for release is "beginning of autumn".