@@ -1602,6 +1602,17 @@ func Render(ctx context.Context, c *client.Client, opts Options) ([]byte, error)
16021602 helmEngine .LookupFunc = newLookupFunction (ctx , c , cmdName , opts .TalosEndpoints )
16031603 }
16041604
1605+ // Require at least one template before loading and rendering the chart.
1606+ // Rendering it first would be wasted (the output is discarded when no
1607+ // template is selected) and, worse, the render fires live lookups whose
1608+ // "connection refused" then masks the real problem: the operator forgot
1609+ // --file / --template. Fail fast with the actionable error instead. This
1610+ // runs after the online multi-node guard, which is a cheaper precondition
1611+ // with no network I/O.
1612+ if len (opts .TemplateFiles ) == 0 {
1613+ return nil , errors .New ("templates are not set for the command: please use `--file` or `--template` flag" )
1614+ }
1615+
16051616 chartPath , err := os .Getwd ()
16061617 if err != nil {
16071618 return nil , errors .Wrap (err , "resolving working directory" )
@@ -1633,10 +1644,6 @@ func Render(ctx context.Context, c *client.Client, opts Options) ([]byte, error)
16331644 return nil , errors .Wrap (err , "rendering chart" )
16341645 }
16351646
1636- if len (opts .TemplateFiles ) == 0 {
1637- return nil , errors .New ("templates are not set for the command: please use `--file` or `--template` flag" )
1638- }
1639-
16401647 configPatches := []string {}
16411648
16421649 for _ , templateFile := range opts .TemplateFiles {
0 commit comments