{"record":{"id":"b1f71066956e0f41","repo":"qax-os/excelize","slug":"errunprotectworkbookpassword","errorCode":"ErrUnprotectWorkbookPassword","errorMessage":"workbook protect password not match","messagePattern":"workbook protect password not match","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":191,"sourceCode":"\tErrTotalSheetHyperlinks = errors.New(\"over maximum limit hyperlinks in a worksheet\")\n\t// ErrTransparency defined the error message for receiving a transparency\n\t// value exceeds limit.\n\tErrTransparency = errors.New(\"transparency value must be an integer from 0 to 100\")\n\t// ErrUnknownEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnknownEncryptMechanism = errors.New(\"unknown encryption mechanism\")\n\t// ErrUnprotectSheet defined the error message on worksheet has set no\n\t// protection.\n\tErrUnprotectSheet = errors.New(\"worksheet has set no protect\")\n\t// ErrUnprotectSheetPassword defined the error message on remove sheet\n\t// protection with password verification failed.\n\tErrUnprotectSheetPassword = errors.New(\"worksheet protect password not match\")\n\t// ErrUnprotectWorkbook defined the error message on workbook has set no\n\t// protection.\n\tErrUnprotectWorkbook = errors.New(\"workbook has set no protect\")\n\t// ErrUnprotectWorkbookPassword defined the error message on remove workbook\n\t// protection with password verification failed.\n\tErrUnprotectWorkbookPassword = errors.New(\"workbook protect password not match\")\n\t// ErrUnsupportedEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnsupportedEncryptMechanism = errors.New(\"unsupported encryption mechanism\")\n\t// ErrUnsupportedHashAlgorithm defined the error message on unsupported\n\t// hash algorithm.\n\tErrUnsupportedHashAlgorithm = errors.New(\"unsupported hash algorithm\")\n\t// ErrUnsupportedNumberFormat defined the error message on unsupported\n\t// number format expression.\n\tErrUnsupportedNumberFormat = errors.New(\"unsupported number format token\")\n\t// ErrUnsupportedPivotTableShowValuesAsType defined the error message on\n\t// receiving the unsupported pivot table \"show values as\" type.\n\tErrUnsupportedPivotTableShowValuesAsType = errors.New(\"unsupported pivot table show values as type\")\n\t// ErrWorkbookFileFormat defined the error message on receive an\n\t// unsupported workbook file format.\n\tErrWorkbookFileFormat = errors.New(\"unsupported workbook file format\")\n\t// ErrWorkbookPassword defined the error message on receiving the incorrect\n\t// workbook password.\n\tErrWorkbookPassword = errors.New(\"the supplied open workbook password is not correct\")","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L173-L209","documentation":"ErrUnprotectWorkbookPassword indicates that the password supplied to UnprotectWorkbook failed hash verification against the workbook protection hash. The library throws it from UnprotectWorkbook when wb.WorkbookProtection.WorkbookHashValue does not match the computed hash.","triggerScenarios":"Calling f.UnprotectWorkbook(\"wrongPassword\") on a password-protected workbook (workbook.go:179 hash comparison fails).","commonSituations":"Wrong or mistyped password; protection password set by another application or user; hash algorithm mismatch after file round-trip.","solutions":["Supply the exact password used with ProtectWorkbook","If lost, remove workbookProtection element from workbook.xml manually","Re-create the workbook without protection"],"exampleFix":"// before\nerr := f.UnprotectWorkbook(\"wrongPassword\")\n// after\nerr := f.UnprotectWorkbook(\"password\") // actual protection password","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := f.UnprotectWorkbook(pw); err != nil {\n\tif errors.Is(err, excelize.ErrUnprotectWorkbookPassword) {\n\t\treturn fmt.Errorf(\"incorrect workbook password\")\n\t}\n\treturn err\n}","preventionTips":["Store the workbook protection password used in ProtectWorkbook","Use the same algorithm and password across save/load cycles","Never assume a default password"],"tags":["go","excelize","workbook-protection","password"],"backgroundTag":"incorrect-password","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}