funmaker / Hybooru

Hydrus-based booru-styled imageboard in React
https://booru.funmaker.moe/
MIT License
95 stars 15 forks source link

Database creation/update crashes with "invalid byte sequence for encoding "UTF8": 0x00"" #8

Closed AlexCSDev closed 2 years ago

AlexCSDev commented 2 years ago

Hi.

I'm trying to run Hybooru's docker container and it keeps crashing with "invalid byte sequence for encoding "UTF8": 0x00" database error.

Hydrus DB version: 456 (synchronized with PTR)

Docker compose configuration:

  hybooru:
    container_name: hybooru
    image: ghcr.io/funmaker/hybooru:latest
    restart:
      unless-stopped
    volumes:
     - /storage/hybooru/configs.json:/app/configs.json
     - /storage/hydrus/db:/hydrusdata
  postgres:
    container_name: postgres
    image: postgres
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: 123
    ports:
     - 5432:5432
    volumes:
     - /storage/postgres:/var/lib/postgresql/data

Database created using the following commands:

CREATE DATABASE hybooru
CREATE USER hybooru WITH PASSWORD '123';
GRANT ALL PRIVILEGES ON DATABASE "hybooru" to hybooru;

Full log:

> hybooru@1.4.5 start
> node server.js
Booru started on port 80
Environment: production.
Press Ctrl-C to terminate.
Database update detected, rebuilding...
Rebuilding Database!
Posts                           [####################] Done in 7.29s
Urls                            [####################] Done in 4.68s
/app/node_modules/pg-protocol/src/parser.ts:357
        : new DatabaseError(messageValue, length, name)
          ^
error: invalid byte sequence for encoding "UTF8": 0x00
    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/src/parser.ts:357:11)
    at Parser.handlePacket (/app/node_modules/pg-protocol/src/parser.ts:186:21)
    at Parser.parse (/app/node_modules/pg-protocol/src/parser.ts:101:30)
    at Socket.<anonymous> (/app/node_modules/pg-protocol/src/index.ts:7:48)
    at Socket.emit (node:events:365:28)
    at addChunk (node:internal/streams/readable:314:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Tags                            [####################
funmaker commented 2 years ago

Hi. This is caused by invalid utf-8 tags. Try to run a job that fixes them in Hydrus(database > check and repair > fix invalid tags). I'm not 100% sure this job also applies to tags from repositories. If that's not the case, ask the maintainer of that repo to fix them.

AlexCSDev commented 2 years ago

Wow, I didn't even know of that job in Hydrus.

Thank you, now it works properly! Sorry for taking your time.