{"record":{"id":"29524745a512afe4","repo":"Netflix/chaosmonkey","slug":"deployschedule-could-not-publish-schedule-v","errorCode":null,"errorMessage":"deploySchedule: could not publish schedule: %v","messagePattern":"deploySchedule: could not publish schedule: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/schedule.go","lineNumber":91,"sourceCode":"\t}\n\n\treturn nil\n}\n\n// deploySchedule publishes the schedule to chaosmonkey-api\n// and registers the schedule with the local cron\nfunc deploySchedule(s *schedule.Schedule, ss schedstore.SchedStore, cfg *config.Monkey) error {\n\tloc, err := cfg.Location()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deploySchedule: could not retrieve local timezone: %v\", err)\n\t}\n\n\ttoday := time.Now().In(loc)\n\n\terr = ss.Publish(today, s)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deploySchedule: could not publish schedule: %v\", err)\n\t}\n\n\terr = registerWithCron(s, cfg)\n\treturn err\n}\n\n// registerWithCron registers the schedule of terminations with cron on the local machine\n//\n// Creates or overwrites the file specified by config.Chaos.CronPath()\nfunc registerWithCron(s *schedule.Schedule, cfg *config.Monkey) error {\n\tcrontab := s.Crontab(cfg.TermPath(), cfg.TermAccount())\n\tvar perms os.FileMode = 0644 // -rw-r--r--\n\tlog.Printf(\"Writing %s\\n\", cfg.CronPath())\n\terr := ioutil.WriteFile(cfg.CronPath(), crontab, perms)\n\treturn err\n}\n","sourceCodeStart":73,"sourceCodeEnd":108,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/command/schedule.go#L73-L108","documentation":"After computing 'today' in the local timezone, deploySchedule persists the schedule via ss.Publish (the SchedStore, e.g. backed by Cloud Datastore or chaosmonkey-api). If Publish returns an error, the schedule was not saved and this wrapped error is returned; cron registration is skipped. The underlying cause follows the colon.","triggerScenarios":"deploySchedule (via the schedule command) when ss.Publish(today, s) fails: storage backend unreachable, authentication/permission failure, or the store rejects the schedule payload.","commonSituations":"Cloud Datastore/API outages, missing service-account permissions to write schedule entities, network partition from the monkey server, or corrupted/oversized schedule data.","solutions":["Read the wrapped cause to identify whether it is a network, auth, or storage error.","Verify the schedstore backend (Datastore/chaosmonkey-api) is up and credentials have write access to the schedule entities.","Check network connectivity from the monkey host to the storage backend and retry after transient failures.","Validate the generated schedule entries if the cause indicates a bad-entity/payload error."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: confirm the schedstore backend is writable before deploying\nif err := schedStoreHealthy(ss); err != nil {\n    return fmt.Errorf(\"schedstore unavailable: %v\", err)\n}\n// schedStoreHealthy issues a lightweight read/write probe per your SchedStore implementation","typeGuard":null,"tryCatchPattern":"if err := do(dep, appCfgGetter, schedStore, cfg, constrainer, apps); err != nil {\n    if strings.Contains(err.Error(), \"could not publish schedule\") {\n        log.Errorf(\"publish failed: %v\", errors.Unwrap(err))\n        // retry with backoff for transient backend errors\n        for i := 0; i < 3; i++ {\n            time.Sleep(time.Duration(1<<i) * time.Second)\n            if err2 := do(dep, appCfgGetter, schedStore, cfg, constrainer, apps); err2 == nil {\n                return nil\n            }\n        }\n        return err\n    }\n    return err\n}","preventionTips":["Monitor and alert on schedstore (Datastore/API) availability before scheduling windows.","Grant the service account explicit write permissions to schedule entities.","Implement bounded retries with exponential backoff for transient publish failures.","Keep schedule payloads within store limits and validate entries before publishing."],"tags":["schedule","storage","persistence"],"backgroundTag":"schedule-publish-failed","analyzedSha":"eaa28fb761c0ebe8644d1333e5d164e9cc3071e9","analyzedAt":"2026-09-03T17:04:39.020Z","contentChangedAt":"2026-09-03T17:04:39.020Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}