flipped-aurora/gin-vue-admin · error

page为表单生成器!

Error message

page为表单生成器!

What it means

In autoCodePackage.Create()'s validation switch, the case info.Template == "page" returns 'page为表单生成器!' — "page" is reserved for the form generator and is not a valid template for creating a package.

Source

Thrown at server/service/system/auto_code_package.go:35

	"github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
	"github.com/flipped-aurora/gin-vue-admin/server/utils/autocode"
	"github.com/pkg/errors"
	"gorm.io/gorm"
)

var AutoCodePackage = new(autoCodePackage)

type autoCodePackage struct{}

// Create 创建包信息
// @author: [piexlmax](https://github.com/piexlmax)
// @author: [SliverHorn](https://github.com/SliverHorn)
func (s *autoCodePackage) Create(ctx context.Context, info *request.SysAutoCodePackageCreate) error {
	switch {
	case info.Template == "":
		return errors.New("模板不能为空!")
	case info.Template == "page":
		return errors.New("page为表单生成器!")
	case info.PackageName == "":
		return errors.New("PackageName不能为空!")
	case token.IsKeyword(info.PackageName):
		return errors.Errorf("%s为go的关键字!", info.PackageName)
	case info.Template == "package":
		if info.PackageName == "system" || info.PackageName == "example" {
			return errors.New("不能使用已保留的package name")
		}
	default:
		break
	}
	if !errors.Is(global.GVA_DB.Where("package_name = ? and template = ?", info.PackageName, info.Template).First(&model.SysAutoCodePackage{}).Error, gorm.ErrRecordNotFound) {
		return errors.New("存在相同PackageName")
	}
	create := info.Create()
	return global.GVA_DB.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
		err := tx.Create(&create).Error
		if err != nil {

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Change the template value to a valid package template such as "package".
  2. Do not reuse the form-generator (page) template for package creation; create pages through the page/form-generator flow instead.
  3. Fix the frontend to send the package-specific template when in package mode.
  4. Review the SysAutoCodePackageCreate request schema for allowed template values.

Example fix

// before
await api.createPackage({ template: 'page', packageName: 'order' })
// after
await api.createPackage({ template: 'package', packageName: 'order' })
Defensive patterns

Strategy: validation

Validate before calling

// restrict template choices for package creation
const allowed = ['package']
if (!allowed.includes(form.template)) {
  ElMessage.warning('包模板仅支持 package,page 属于表单生成器')
  return
}
await api.createPackage(form)

Try / catch

try {
  await svc.Create(ctx, info)
} catch (err) {
  if (err.Error() == "page为表单生成器!") {
    // redirect user to the page/form-generator flow instead
  } else {
    return err
  }
}

Prevention

When it happens

Trigger: Calling the package create API with template set to "page" instead of a valid package template value.

Common situations: Client sends the currently selected form-generator template name into the package creation form; copy-pasted payload from a page-template request; confusion between page templates and package templates in the auto-code UI.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/e54a3ac5002a0fd7. Report an issue: GitHub.