Skip to content

(BUG) Manuscript Error in Bats Server Logs #453

Description

@vukilelanga

In bats-server logs, there were errors related to a manuscript query:

2026-07-08 16:00:00.008	
Importing manuscripts. Triggered by system

2026-07-08 16:00:00.525	
{
  "level": "ERROR",
  "time": "2026-07-08T14:00:00.524Z",
  "pid": 664,
  "hostname": "7843322c574028",
  "err": {
    "type": "DataError",
    "message": "update \"manuscripts\" set \"updated\" = $1, \"type\" = $2, \"is_hidden\" = $3 where \"created\" < $4 and \"status\" = $5 and \"group_id\" = $6 and not \"is_hidden\" = $7 and (submission->>'$customStatus' = '' or submission->>'$customStatus' IS NULL) - invalid input syntax for type timestamp with time zone: \"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN\"",
    "stack": "DataError: update \"manuscripts\" set \"updated\" = $1, \"type\" = $2, \"is_hidden\" = $3 where \"created\" < $4 and \"status\" = $5 and \"group_id\" = $6 and not \"is_hidden\" = $7 and (submission->>'$customStatus' = '' or submission->>'$customStatus' IS NULL) - invalid input syntax for type timestamp with time zone: \"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN\"\n    at wrapError (/home/node/app/node_modules/db-errors/lib/dbErrors.js:19:14)\n    at handleExecuteError (/home/node/app/node_modules/@coko/server/node_modules/objection/lib/queryBuilder/QueryBuilder.js:1140:32)\n    at QueryBuilder.execute (/home/node/app/node_modules/@coko/server/node_modules/objection/lib/queryBuilder/QueryBuilder.js:449:20)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async archiveOldManuscripts (/home/node/app/dist/controllers/manuscript/manuscriptCommsUtils.js:53:27)\n    at async Job.fn [as job] (/home/node/app/dist/utils/jobUtils.js:28:21)",
    "name": "DataError",
    "nativeError": {
      "type": "DatabaseError",
      "message": "update \"manuscripts\" set \"updated\" = $1, \"type\" = $2, \"is_hidden\" = $3 where \"created\" < $4 and \"status\" = $5 and \"group_id\" = $6 and not \"is_hidden\" = $7 and (submission->>'$customStatus' = '' or submission->>'$customStatus' IS NULL) - invalid input syntax for type timestamp with time zone: \"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN\"",
      "stack": "error: update \"manuscripts\" set \"updated\" = $1, \"type\" = $2, \"is_hidden\" = $3 where \"created\" < $4 and \"status\" = $5 and \"group_id\" = $6 and not \"is_hidden\" = $7 and (submission->>'$customStatus' = '' or submission->>'$customStatus' IS NULL) - invalid input syntax for type timestamp with time zone: \"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN\"\n    at Object.queryBuilder (/home/node/app/node_modules/knex/lib/knex-builder/make-knex.js:112:26)\n    at knex.value (/home/node/app/node_modules/knex/lib/knex-builder/make-knex.js:92:29)\n    at buildKnexQuery (/home/node/app/node_modules/@coko/server/node_modules/objection/lib/queryBuilder/QueryBuilder.js:1240:63)\n    at doExecute (/home/node/app/node_modules/@coko/server/node_modules/objection/lib/queryBuilder/QueryBuilder.js:1099:31)\n    at QueryBuilder.execute (/home/node/app/node_modules/@coko/server/node_modules/objection/lib/queryBuilder/QueryBuilder.js:446:28)\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n    at async archiveOldManuscripts (/home/node/app/dist/controllers/manuscript/manuscriptCommsUtils.js:53:27)\n    at async Job.fn [as job] (/home/node/app/dist/utils/jobUtils.js:28:21)",
      "length": 197,
      "name": "error",
      "severity": "ERROR",
      "code": "22007",
      "where": "unnamed portal parameter $4 = '...'",
      "file": "datetime.c",
      "line": "4140",
      "routine": "DateTimeParseError",
      "originalStack": "error: update \"manuscripts\" set \"updated\" = $1, \"type\" = $2, \"is_hidden\" = $3 where \"created\" < $4 and \"status\" = $5 and \"group_id\" = $6 and not \"is_hidden\" = $7 and (submission->>'$customStatus' = '' or submission->>'$customStatus' IS NULL) - invalid input syntax for type timestamp with time zone: \"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN\"\n    at parseErrorMessage (/home/node/app/node_modules/pg-protocol/dist/parser.js:305:11)\n    at Parser.handlePacket (/home/node/app/node_modules/pg-protocol/dist/parser.js:143:27)\n    at Parser.parse (/home/node/app/node_modules/pg-protocol/dist/parser.js:37:38)\n    at Socket.<anonymous> (/home/node/app/node_modules/pg-protocol/dist/index.js:11:42)\n    at Socket.emit (node:events:509:28)\n    at addChunk (node:internal/streams/readable:563:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:514:3)\n    at Readable.push (node:internal/streams/readable:394:5)\n    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)"
    },
    "client": "postgres"
  },
  "msg": "update \"manuscripts\" set \"updated\" = $1, \"type\" = $2, \"is_hidden\" = $3 where \"created\" < $4 and \"status\" = $5 and \"group_id\" = $6 and not \"is_hidden\" = $7 and (submission->>'$customStatus' = '' or submission->>'$customStatus' IS NULL) - invalid input syntax for type timestamp with time zone: \"0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN\""
}

Eventually the machine runs out of memory:

2026-07-08 16:00:23.103	
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
2026-07-08 16:00:23.096	
[664:0x234e9000] 82557559 ms: Mark-Compact (reduce) 478.7 (491.9) -> 472.5 (483.9) MB, pooled: 0 MB, 99.41 / 0.00 ms  (+ 167.8 ms in 107 steps since start of marking, biggest step 24.1 ms, walltime since start of marking 314 ms) (average mu = 0.992, curre
2026-07-08 16:00:23.096	
[664:0x234e9000] 82557245 ms: Scavenge (interleaved) 473.0 (482.1) -> 471.9 (491.9) MB, pooled: 0 MB, 2.42 / 0.00 ms  (average mu = 0.996, current mu = 0.825) allocation failure;

Causing a server restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions