{"record":{"id":"b4d71345e80e2a93","repo":"SigNoz/signoz","slug":"codeinvalidinput-b4d713","errorCode":"CodeInvalidInput","errorMessage":"refresh token is required","messagePattern":"refresh token is required","errorType":"validation","errorClass":"errors SigNozError","httpStatus":400,"severity":"error","filePath":"pkg/types/authtypes/token.go","lineNumber":117,"sourceCode":"func NewURLValuesFromToken(token *Token, rotationInterval time.Duration) url.Values {\n\treturn url.Values{\n\t\t\"tokenType\":    {\"bearer\"},\n\t\t\"accessToken\":  {token.AccessToken},\n\t\t\"refreshToken\": {token.RefreshToken},\n\t\t\"expiresIn\":    {strconv.Itoa(int(time.Until(token.RotationAt(rotationInterval)).Seconds()))},\n\t}\n}\n\nfunc (typ *PostableRotateToken) UnmarshalJSON(data []byte) error {\n\ttype Alias PostableRotateToken\n\tvar temp Alias\n\n\tif err := json.Unmarshal(data, &temp); err != nil {\n\t\treturn err\n\t}\n\n\tif temp.RefreshToken == \"\" {\n\t\treturn errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"refresh token is required\")\n\t}\n\n\t*typ = PostableRotateToken(temp)\n\treturn nil\n}\n\nfunc (typ *Token) IsValid(rotationInterval time.Duration, idleDuration time.Duration, maxDuration time.Duration) error {\n\t// Check for expiration\n\tif err := typ.IsExpired(idleDuration, maxDuration); err != nil {\n\t\treturn err\n\t}\n\n\t// Check for rotation\n\tif err := typ.IsRotationRequired(rotationInterval); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/authtypes/token.go#L99-L135","documentation":"Thrown by PostableRotateToken.UnmarshalJSON when the refresh token field is missing. The token rotation endpoint requires the current refresh token to issue a new pair.","triggerScenarios":"POST to the token rotation endpoint with an empty or absent refreshToken in the body.","commonSituations":"Client lost or never stored the refresh token, token was already rotated and the old one consumed, or the field name is misnamed in the request.","solutions":["Send the current refreshToken value in the rotate request body","Persist new refresh tokens immediately after each rotation since they may be single-use","If lost, re-authenticate to obtain a fresh token pair"],"exampleFix":"// before\nPOST /api/v1/tokens/rotate {}\n// after\nPOST /api/v1/tokens/rotate {\"refreshToken\": \"eyJhbGciOi...\"}","handlingStrategy":"validation","validationCode":"if req.RefreshToken == \"\" { return errors.New(\"refreshToken is required\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Durable-store refresh tokens immediately after auth","Handle single-use semantics: never assume an old refresh token remains valid"],"tags":["tokens","auth","refresh-token","request-validation"],"backgroundTag":"missing-refresh-token","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}