diff --git a/jobspec/parse.go b/jobspec/parse.go index f9defa7cf43..d0606ef2764 100644 --- a/jobspec/parse.go +++ b/jobspec/parse.go @@ -84,10 +84,13 @@ func ParseFile(path string) (*structs.Job, error) { } func parseJob(result *structs.Job, list *ast.ObjectList) error { - list = list.Children() if len(list.Items) != 1 { return fmt.Errorf("only one 'job' block allowed") } + list = list.Children() + if len(list.Items) != 1 { + return fmt.Errorf("'job' block missing name") + } // Get our job object obj := list.Items[0]