microg/GmsCore · error · IllegalStateException
Must set attenuationBucketWeights
Error message
Must set attenuationBucketWeights
What it means
DailySummariesConfig.Builder.build() throws IllegalStateException when attenuationBucketWeights was never set. The config needs one weight per attenuation bucket to score each exposure day; without it the summary would be meaningless, so the builder fails fast.
Source
Thrown at play-services-nearby/src/main/java/com/google/android/gms/nearby/exposurenotification/DailySummariesConfig.java:190
*/
public static class DailySummariesConfigBuilder {
private Double[] reportTypeWeights = new Double[ReportType.VALUES];
private Double[] infectiousnessWeights = new Double[Infectiousness.VALUES];
private List<Integer> attenuationBucketThresholdDb;
private List<Double> attenuationBucketWeights;
private int daysSinceExposureThreshold;
private double minimumWindowScore;
public DailySummariesConfigBuilder() {
Arrays.fill(reportTypeWeights, 0.0);
Arrays.fill(infectiousnessWeights, 0.0);
}
public DailySummariesConfig build() {
if (attenuationBucketThresholdDb == null)
throw new IllegalStateException("Must set attenuationBucketThresholdDb");
if (attenuationBucketWeights == null)
throw new IllegalStateException("Must set attenuationBucketWeights");
DailySummariesConfig config = new DailySummariesConfig();
config.reportTypeWeights = Arrays.asList(reportTypeWeights);
config.infectiousnessWeights = Arrays.asList(infectiousnessWeights);
config.attenuationBucketThresholdDb = attenuationBucketThresholdDb;
config.attenuationBucketWeights = attenuationBucketWeights;
config.daysSinceExposureThreshold = daysSinceExposureThreshold;
config.minimumWindowScore = minimumWindowScore;
return config;
}
/**
* See {@link #getAttenuationBucketThresholdDb()} and {@link #getAttenuationBucketWeights()}
*/
public DailySummariesConfigBuilder setAttenuationBuckets(List<Integer> thresholds, List<Double> weights) {
attenuationBucketThresholdDb = new ArrayList<>(thresholds);
attenuationBucketWeights = new ArrayList<>(weights);
return this;
}View on GitHub (pinned to 157c9d86ac)
Solutions
- Call builder.setAttenuationBucketWeights(...) with 4 weights (one per attenuation bucket) before build()
- Verify the weights list size matches the number of buckets implied by the thresholds
- Review the builder chain to ensure no required setter is skipped
Example fix
// before builder.setAttenuationBucketThresholdDb(Arrays.asList(30, 40, 60)); DailySummariesConfig config = builder.build(); // after builder.setAttenuationBucketThresholdDb(Arrays.asList(30, 40, 60)); builder.setAttenuationBucketWeights(Arrays.asList(1.0, 1.0, 1.0, 1.0)); DailySummariesConfig config = builder.build();
Defensive patterns
Strategy: validation
Validate before calling
List<Double> weights = Arrays.asList(1.0, 1.0, 1.0, 1.0);
if (weights == null || weights.size() != 4) {
throw new IllegalStateException("attenuationBucketWeights must be set (4 values)");
}
DailySummariesConfig config = builder.setAttenuationBucketWeights(weights).build(); Try / catch
try {
DailySummariesConfig config = builder.build();
} catch (IllegalStateException e) {
Log.w(TAG, "Incomplete DailySummariesConfig: " + e.getMessage());
} Prevention
- Set weights immediately after thresholds in the builder chain
- Review the build() source for the complete list of required fields
- Add a smoke test that builds the default app config at startup
When it happens
Trigger: Calling DailySummariesConfig.Builder.build() without calling setAttenuationBucketWeights(List<Double>) — only after the attenuationBucketThresholdDb check has already passed.
Common situations: Developers set thresholds but forget the matching weights list, or copy an example config that sets weights conditionally.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Must set attenuationBucketThresholdDb
- Must set daysSinceOnsetToInfectiousness
- Must set reportTypeWhenMissing
- Must set infectiousnessWhenDaysSinceOnsetMissing
- daysSinceOnsetToInfectiousness exceeds MAX_DAYS days
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/0752f9ec44b516eb.
Report an issue: GitHub.