{"record":{"id":"8ba5908983492942","repo":"microg/GmsCore","slug":"durationmillis-must-be-greater-than-0","errorCode":null,"errorMessage":"durationMillis must be greater than 0","messagePattern":"durationMillis must be greater than 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java","lineNumber":168,"sourceCode":"            request.throttleBehavior = throttleBehavior;\n            request.moduleId = moduleId;\n            request.workSource = new WorkSource(workSource);\n            request.impersonation = impersonation;\n            return request;\n        }\n\n        /**\n         * Sets the duration in milliseconds of the location request used to derive the current location if no historical location satisfies the current\n         * location request. If this duration expires with no location, the current location request will return a null location. The current location request\n         * may fail and return a null location after a shorter duration, but never a longer duration.\n         * <p>\n         * NOTE: Internally, this duration may be capped with what the Fused Location Provider believes is a reasonable maximum duration until it is unlikely\n         * that any current location can be derived. This value is usually around roughly 30 seconds.\n         * <p>\n         * The default value is {@link Long#MAX_VALUE}.\n         */\n        public CurrentLocationRequest.Builder setDurationMillis(long durationMillis) {\n            if (durationMillis <= 0) throw new IllegalArgumentException(\"durationMillis must be greater than 0\");\n            this.durationMillis = durationMillis;\n            return this;\n        }\n\n        /**\n         * Sets the {@link Granularity} of locations returned for this request. This controls whether fine or coarse locations may be returned.\n         * <p>\n         * The default value is {@link Granularity#GRANULARITY_PERMISSION_LEVEL}.\n         */\n        public CurrentLocationRequest.Builder setGranularity(@Granularity int granularity) {\n            GranularityUtil.checkValidGranularity(granularity);\n            this.granularity = granularity;\n            return this;\n        }\n\n        /**\n         * Sets the maximum age of any location returned for this request. A value of 0 indicates that only freshly derived locations will be returned, and no\n         * historical locations will ever be returned. A value {@link Long#MAX_VALUE} represents an effectively unbounded maximum age.","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java#L150-L186","documentation":"Builder validation in CurrentLocationRequest.Builder.setDurationMillis: the requested duration is <= 0, but a strictly positive duration is required for the location request used to derive the current location.","triggerScenarios":"Thrown at play-services-location/src/main/java/com/google/android/gms/location/CurrentLocationRequest.java:168 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a positive duration in milliseconds","Use a sensible default duration when none is explicitly configured"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}