{"record":{"id":"c150e45d6675b336","repo":"slimtoolkit/slim","slug":"fcgi-invalid-header-version","errorCode":null,"errorMessage":"fcgi: invalid header version","messagePattern":"fcgi: invalid header version","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/probe/http/internal/client.go","lineNumber":159,"sourceCode":"func (h *header) init(recType uint8, reqID uint16, contentLength int) {\n\th.Version = 1\n\th.Type = recType\n\th.ID = reqID\n\th.ContentLength = uint16(contentLength)\n\th.PaddingLength = uint8(-contentLength & 7)\n}\n\ntype record struct {\n\th    header\n\trbuf []byte\n}\n\nfunc (rec *record) read(r io.Reader) (buf []byte, err error) {\n\tif err = binary.Read(r, binary.BigEndian, &rec.h); err != nil {\n\t\treturn\n\t}\n\tif rec.h.Version != 1 {\n\t\terr = errors.New(\"fcgi: invalid header version\")\n\t\treturn\n\t}\n\tif rec.h.Type == EndRequest {\n\t\terr = io.EOF\n\t\treturn\n\t}\n\tn := int(rec.h.ContentLength) + int(rec.h.PaddingLength)\n\tif len(rec.rbuf) < n {\n\t\trec.rbuf = make([]byte, n)\n\t}\n\tif _, err = io.ReadFull(r, rec.rbuf[:n]); err != nil {\n\t\treturn\n\t}\n\tbuf = rec.rbuf[:int(rec.h.ContentLength)]\n\n\treturn\n}\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/probe/http/internal/client.go#L141-L177","documentation":"The internal FastCGI client reads response records whose header carries a protocol version byte; per the FastCGI spec it must be FCGI_VERSION_1. Any other version byte means the stream is not a valid FastCGI response, so the reader rejects it.","triggerScenarios":"Reading a record whose header version byte != 1 — typically because the endpoint returned plain HTTP/HTML (e.g. an error page) or a server speaking a different/incompatible protocol instead of FastCGI.","commonSituations":"Pointing the probe at a non-FastCGI port; a reverse proxy or web server responding with an HTTP error page; garbage/corrupted response bytes.","solutions":["Confirm the target address/port speaks FastCGI (e.g. php-fpm on 9000), not HTTP","Check what the server actually returned (error page, redirect, TLS handshake bytes)","Fix the probe URL/scheme so it doesn't hit an HTTP-only endpoint"],"exampleFix":"// before\nprobeURL = \"http://svc:80/status\"   // plain HTTP\n// after\nprobeURL = \"fcgi://svc:9000/status\" // FastCGI endpoint","handlingStrategy":"validation","validationCode":"// verify the endpoint speaks FastCGI before probing\nu, _ := url.Parse(probeURL)\nif u.Scheme != \"fcgi\" { return fmt.Errorf(\"probe target must be fcgi://, got %s\", u.Scheme) }","typeGuard":null,"tryCatchPattern":"body, err := client.Read()\nif err != nil && strings.Contains(err.Error(), \"invalid header version\") {\n  return fmt.Errorf(\"endpoint did not return FastCGI records; check scheme/port: %w\", err)\n}","preventionTips":["Point probes at the FastCGI port (e.g. php-fpm 9000), not the HTTP port","Don't route probes through plain-HTTP reverse proxies","Confirm the backend's protocol before configuring the probe"],"tags":["fastcgi","protocol","http-probe"],"backgroundTag":"protocol-version-mismatch","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}