diff --git a/run/run.go b/run/run.go index 8ae80e1f8d..62810bde83 100644 --- a/run/run.go +++ b/run/run.go @@ -86,10 +86,12 @@ func GetMain() *cobra.Command { return err } - // add openAPI definitions from Kptfile to configured openAPI - if addErr := openapi.AddSchemaFromFile(filepath.Join(args[0], kptfile.KptFileName)); addErr != nil { - // do not throw error if schema doesn't exist or not readable from Kptfile - return nil + if len(args) > 0 { + // add openAPI definitions from Kptfile to configured openAPI + if addErr := openapi.AddSchemaFromFile(filepath.Join(args[0], kptfile.KptFileName)); addErr != nil { + // do not throw error if schema doesn't exist or not readable from Kptfile + return nil + } } return nil }