AlexxIT/go2rtc · error

wrong response

Error message

wrong response: %s

What it means

Raised in DVRIP ReadJSON when a JSON response parses successfully but its Ret status code is neither 100 (OK) nor 515 (also accepted success), meaning the camera rejected the command or returned an unexpected status; the raw payload is embedded for diagnosis.

Solutions

  1. Inspect the embedded payload to read the actual Ret code and nested error message
  2. Verify credentials are logged in and not expired before issuing the command (Login again)
  3. Confirm the command/parameters are supported by this camera firmware
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/dvrip/client.go:231 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/6d375ee2baa3befe. Report an issue: GitHub.

Appendix: source

Thrown at pkg/dvrip/client.go:231

	return
}

type Response map[string]any

func (c *Client) ReadJSON() (res Response, err error) {
	b, err := c.ReadChunk()
	if err != nil {
		return
	}

	res = Response{}
	if err = json.Unmarshal(b[:len(b)-2], &res); err != nil {
		return
	}

	if v, ok := res["Ret"].(float64); !ok || (v != 100 && v != 515) {
		err = fmt.Errorf("wrong response: %s", b)
	}
	return
}

func SofiaHash(password string) string {
	const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

	sofia := make([]byte, 0, 8)
	hash := md5.Sum([]byte(password))
	for i := 0; i < md5.Size; i += 2 {
		j := uint16(hash[i]) + uint16(hash[i+1])
		sofia = append(sofia, chars[j%62])
	}

	return string(sofia)
}

View on GitHub (pinned to c245815e75)