Jason encoding error #112

Open
opened 2026-01-13 08:35:03 +00:00 by jabe · 10 comments
Member

Environment

  • Installation type: from source
  • Pleroma 2.10.0-1-g15c55804
  • Elixir 1.18.0 (compiled with Erlang/OTP 27)
  • Operating system: archlinux armv7
  • PostgreSQL version: 18.1

Description

When opening the fontend, I got a message box "An unexpected error occurred". The network console shows that /api/v1/pleroma/admin/config returns status 500. The issue persists for some time now and after the last update I would like to fix it.

Log

Request: GET /api/v1/pleroma/admin/config
** (exit) an exception was raised:
     ** (Jason.EncodeError) invalid byte 0x82 in <<48, 130, 5, 86, 48, 130, 3, 62, 160, 3, 2, 1, 2, 2, 20, 67, 227, 113, 19, 216, 179, 89, 20, 93, 183, 206, 140, 253, 53, 253, 111, 188, 5, 141, 69, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, ...>>
         (jason 1.4.4) lib/jason.ex:213: Jason.encode_to_iodata!/2
         (phoenix 1.7.14) lib/phoenix/controller.ex:1008: anonymous fn/5 in Phoenix.Controller.template_render_to_iodata/4
         (telemetry 1.0.0) /opt/pleroma/deps/telemetry/src/telemetry.erl:293: :telemetry.span/3
         (phoenix 1.7.14) lib/phoenix/controller.ex:974: Phoenix.Controller.render_and_send/4
         (pleroma 2.10.0-1-g15c55804-arch-fixes) lib/pleroma/web/admin_api/controllers/config_controller.ex:5: Pleroma.Web.AdminAPI.ConfigController.action/2
         (pleroma 2.10.0-1-g15c55804-arch-fixes) lib/pleroma/web/admin_api/controllers/config_controller.ex:5: Pleroma.Web.AdminAPI.ConfigController.phoenix_controller_pipeline/2
         (phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
         (pleroma 2.10.0-1-g15c55804-arch-fixes) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.plug_builder_call/2

Question

Do you have any idea how to debug it and get to the cause of the error? Unfortunately I am not familiar with Erlang at all, otherwise I would have debugged the source already. Thank you.

# Environment * Installation type: from source * Pleroma [2.10.0-1-g15c55804](https://git.pleroma.social/pleroma/pleroma/-/commit/3b99bbd9) * Elixir 1.18.0 (compiled with Erlang/OTP 27) * Operating system: archlinux armv7 * PostgreSQL version: 18.1 # Description When opening the fontend, I got a message box "An unexpected error occurred". The network console shows that `/api/v1/pleroma/admin/config` returns status 500. The issue persists for some time now and after the last update I would like to fix it. # Log ``` Request: GET /api/v1/pleroma/admin/config ** (exit) an exception was raised: ** (Jason.EncodeError) invalid byte 0x82 in <<48, 130, 5, 86, 48, 130, 3, 62, 160, 3, 2, 1, 2, 2, 20, 67, 227, 113, 19, 216, 179, 89, 20, 93, 183, 206, 140, 253, 53, 253, 111, 188, 5, 141, 69, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, ...>> (jason 1.4.4) lib/jason.ex:213: Jason.encode_to_iodata!/2 (phoenix 1.7.14) lib/phoenix/controller.ex:1008: anonymous fn/5 in Phoenix.Controller.template_render_to_iodata/4 (telemetry 1.0.0) /opt/pleroma/deps/telemetry/src/telemetry.erl:293: :telemetry.span/3 (phoenix 1.7.14) lib/phoenix/controller.ex:974: Phoenix.Controller.render_and_send/4 (pleroma 2.10.0-1-g15c55804-arch-fixes) lib/pleroma/web/admin_api/controllers/config_controller.ex:5: Pleroma.Web.AdminAPI.ConfigController.action/2 (pleroma 2.10.0-1-g15c55804-arch-fixes) lib/pleroma/web/admin_api/controllers/config_controller.ex:5: Pleroma.Web.AdminAPI.ConfigController.phoenix_controller_pipeline/2 (phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5 (pleroma 2.10.0-1-g15c55804-arch-fixes) lib/pleroma/web/endpoint.ex:5: Pleroma.Web.Endpoint.plug_builder_call/2 ``` # Question Do you have any idea how to debug it and get to the cause of the error? Unfortunately I am not familiar with Erlang at all, otherwise I would have debugged the source already. Thank you.

Might be something strange in your db. Maybe some kind of cert that ended up there? Can you try this patch and see if it fixes it? then you should be able to see what part of the config isn't valid.
encoding.patch

Might be something strange in your db. Maybe some kind of cert that ended up there? Can you try this patch and see if it fixes it? then you should be able to see what part of the config isn't valid. [encoding.patch](/attachments/d89f56ea-7165-46c8-a3e8-7209dd7a492b)
Author
Member

Thank you very much, that fixes it. Unfortunately the logs do not expose any additional information:

[info] GET /api/v1/pleroma/admin/config
[info] GET /sw.js
path=/sw.js [info] Sent 304 in 3ms
path=/api/v1/pleroma/admin/config user=jabe [info] Sent 200 in 1171ms
[info] GET /favicon.ico
path=/favicon.ico [info] Sent 200 in 79ms
Thank you very much, that fixes it. Unfortunately the logs do not expose any additional information: ``` [info] GET /api/v1/pleroma/admin/config [info] GET /sw.js path=/sw.js [info] Sent 304 in 3ms path=/api/v1/pleroma/admin/config user=jabe [info] Sent 200 in 1171ms [info] GET /favicon.ico path=/favicon.ico [info] Sent 200 in 79ms ```
Author
Member

Btw, what patch format is that and how to apply it correctly? I have just applied the changes manually as git apply did not work which was pretty clear ;).

Btw, what patch format is that and how to apply it correctly? I have just applied the changes manually as `git apply` did not work which was pretty clear ;).

ah sorry, i made it with git diff but i forgot i had difftastic active. Can you look at the json that's returned by /api/v1/pleroma/admin/config? do you see pleroma_binary there somewhere?

ah sorry, i made it with git diff but i forgot i had difftastic active. Can you look at the json that's returned by /api/v1/pleroma/admin/config? do you see __pleroma_binary__ there somewhere?
Author
Member

Ah, thanks. I got 524 occurrences. Example:

"__pleroma_binary__": "933F/cTomht3ZKf1HaDMv4dgmm0="
"__pleroma_binary__": "B5BK3/MjTvDDnFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM="

So actually the JSON tag names are invalid ... right?

Ah, thanks. I got 524 occurrences. Example: ``` "__pleroma_binary__": "933F/cTomht3ZKf1HaDMv4dgmm0=" ``` ``` "__pleroma_binary__": "B5BK3/MjTvDDnFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=" ``` So actually the JSON tag names are invalid ... right?
Author
Member

An example with context:

"tuple": [
    ":ECPoint",
    {
        "__pleroma_binary__": "BCOlDLgtEvUo87Gy3eICEoCeOV9JTZ/JJTRZdOy7BhznwHKv6K4v4UFUhxSoSrLofILmW2q13LN1zosG0IYjv0bVjg8/BPTXHJJ+9qVjwvVfji5PoRgZAisyCoJkfRaT0Q=="
    }
]
An example with context: ``` "tuple": [ ":ECPoint", { "__pleroma_binary__": "BCOlDLgtEvUo87Gy3eICEoCeOV9JTZ/JJTRZdOy7BhznwHKv6K4v4UFUhxSoSrLofILmW2q13LN1zosG0IYjv0bVjg8/BPTXHJJ+9qVjwvVfji5PoRgZAisyCoJkfRaT0Q==" } ] ```
Author
Member

And you are right, I think all issues connect to certificates.

And you are right, I think all issues connect to certificates.
Author
Member

All tuples with :cert are followed by an invalid tag name.

All tuples with `:cert` are followed by an invalid tag name.
Author
Member

Do you have an explanation what is causing the error?

Do you have an explanation what is causing the error?

I don't think it's an actual error, it's just visible now because before we didn't have the amdin api in pleroma-fe, so it was less noticeable when this happened.

I don't think it's an actual error, it's just visible now because before we didn't have the amdin api in pleroma-fe, so it was less noticeable when this happened.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-support#112
No description provided.