AdguardTeam/AdGuardHome · error

validating blocked services: %w

Error message

validating blocked services: %w

What it means

copyBlockedServices could not validate the blocked-services set built from the request: unknown IDs or an invalid weekly schedule. This is the underlying validation behind client update errors.

Source

Thrown at internal/home/clientshttp.go:289

	prev *client.Persistent,
) (svcs *filtering.BlockedServices, err error) {
	var weekly *schedule.Weekly
	if sch != nil {
		weekly = sch.Clone()
	} else if prev != nil {
		weekly = prev.BlockedServices.Schedule.Clone()
	} else {
		weekly = schedule.EmptyWeekly()
	}

	svcs = &filtering.BlockedServices{
		Schedule: weekly,
		IDs:      svcStrs,
	}

	err = svcs.Validate()
	if err != nil {
		return nil, fmt.Errorf("validating blocked services: %w", err)
	}

	return svcs, nil
}

// clientToJSON converts persistent client object to JSON object.
func clientToJSON(c *client.Persistent) (cj *clientJSON) {
	// TODO(d.kolyshev): Remove after cleaning the deprecated
	// [clientJSON.SafeSearchEnabled] field.
	cloneVal := c.SafeSearchConf
	safeSearchConf := &cloneVal

	return &clientJSON{
		Name:                c.Name,
		IDs:                 c.Identifiers(),
		Tags:                c.Tags,
		UseGlobalSettings:   !c.UseOwnSettings,
		FilteringEnabled:    c.FilteringEnabled,

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Use only IDs returned by the blocked-services list endpoint
  2. Validate the schedule format (weekly ranges with valid start/end times) client-side
  3. Re-check payloads after upgrading AdGuard Home since service sets change between versions

Example fix

// before: schedule hour 25
{"day":0,"start":25,"end":26}
// after
{"day":0,"start":0,"end":1}
Defensive patterns

Strategy: validation

Validate before calling

// Validate schedule ranges before sending
for _, r := range schedule {
    if r.Start < 0 || r.End > 24*60 || r.Start >= r.End { return fmt.Errorf("bad range") }
}

Prevention

When it happens

Trigger: A blocked-services payload where svcs.Validate() fails: service IDs not in the known set, or schedule with invalid time ranges/days.

Common situations: Sending service IDs from a different AdGuard Home version, typos in IDs, or schedule JSON with hours outside 0-23 / malformed ranges.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/f498ceb160e738c7. Report an issue: GitHub.