Client <unknown> disconnected due to malformed packet

I have searched the internet alot but could not find any explanation for why my mosquitto broker sometimes throws this “Client disconnected due to malformed packet” error.

Please help me figure out this issue. Is there anything that needs to be done in the yaml or conf file for mosquitto?

Below are my yaml file and conf file

version: '3.5'
services:
  mosquitto:
    container_name: mosquitto_container1
    image: eclipse-mosquitto:latest
    restart: always
    volumes:
      - "./config:/mosquitto/config/:rw"
    ports:
      - '1883:1883'
      - '9001:9001'
      - '8883:8883'
      - '8083:8083'
    tty: true  
    networks:
      - default

conf file

allow_anonymous true
listener 1883
listener 9001
protocol websockets
listener 8883
cafile /mosquitto/config/certs/ca.crt
certfile /mosquitto/config/certs/broker.crt
keyfile /mosquitto/config/certs/broker.key

listener 8083
protocol websockets
cafile /mosquitto/config/certs/ca.crt
certfile /mosquitto/config/certs/broker.crt
keyfile /mosquitto/config/certs/broker.key

require_certificate false

persistence true
persistence_location /mosquitto/data/

tls_version tlsv1.2

Please, always use the </> button to format your code. It is very important for a YAML to be properly indented so it is important for us, to understand it. I edited your post to fix this.

Have you found this?